FIX: allow HTTP <-> HTTPS redirections when downloading images

This commit is contained in:
Régis Hanol
2015-08-17 19:21:30 +02:00
parent 827ea641b0
commit a3e76dc193
3 changed files with 5 additions and 1 deletions

View File

@ -14,7 +14,7 @@ class FileHelper
tmp = Tempfile.new([tmp_file_name, extension])
File.open(tmp.path, "wb") do |f|
downloaded = uri.open("rb", read_timeout: 5, redirect: follow_redirect)
downloaded = uri.open("rb", read_timeout: 5, redirect: follow_redirect, allow_redirections: :all)
while f.size <= max_file_size && data = downloaded.read(512.kilobytes)
f.write(data)
end