Fix weird https redirection downgrade bug
For some reason this endpoint occasionally sends a 302 redirect to an http image instead of https. >:( Ideally this should be reverted back to using https at some point, but I can't reproduce this in any browser, so I have no idea what exactly is causing it. Sometimes changing the referer works for specific images, other times it doesn't. This isn't the most secure, but it should be the most reliable. Hopefully whoever is mitm-ing you isn't concerned with what vsco profiles you're downloading.
This commit is contained in:
parent
66a657baa2
commit
ee04f8fef3
|
@ -79,7 +79,9 @@ images.each_with_index do |r, i|
|
||||||
image_url = r['is_video'] ? r['video_url'] : r['responsive_url']
|
image_url = r['is_video'] ? r['video_url'] : r['responsive_url']
|
||||||
image_path = "#{file_path}#{File.extname image_url}"
|
image_path = "#{file_path}#{File.extname image_url}"
|
||||||
if options[:overwrite] or not File.exist? image_path
|
if options[:overwrite] or not File.exist? image_path
|
||||||
open "https://#{image_url}" do |f|
|
# opening these with https was oddly buggy and would constantly
|
||||||
|
# try to redirect downgrade to http no matter what I did
|
||||||
|
open "http://#{image_url}" do |f|
|
||||||
File.open image_path, 'wb' do |file|
|
File.open image_path, 'wb' do |file|
|
||||||
file.write f.read
|
file.write f.read
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue