Merge pull request #61 from insales/no_cache_upload_from_s3_with_lib

Скачиваем файл из S3, используя библиотеку, а не по ссылке
This commit is contained in:
Nastia
2022-06-20 16:45:56 +03:00
committed by GitHub

View File

@@ -93,10 +93,7 @@ module Paperclip
return unless synced_to?(self.class.main_store_id)
if self.class.download_by_url
# FIXME: do we need to escape here?
uri = URI(URI::DEFAULT_PARSER.escape(storage_url(style)))
response = Net::HTTP.get_response(uri)
create_tempfile(response.body) if response.is_a?(Net::HTTPOK)
create_tempfile(self.class.main_store_id.object(style_key).get.body.read)
else
download_from_store(self.class.main_store_id, style_key)
end