Merge pull request #1432 from okriuchykhin/ok_SCI_2864

Fix S3 zip exports path [SCI-2864]
This commit is contained in:
Luka Murn 2018-12-20 11:08:48 +01:00 committed by GitHub
commit faf6601962
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,9 +9,10 @@ class TeamZipExport < ZipExport
# Override path only for S3
if ENV['PAPERCLIP_STORAGE'] == 's3'
has_attached_file :zip_file,
path: '/zip_exports/:attachment/:id_partition/' \
':hash/:style/:filename'
s3_path = '/zip_exports/:attachment/:id_partition/:hash/:style/:filename'
s3_path.prepend("/#{ENV['S3_SUBFOLDER']}") if ENV['S3_SUBFOLDER']
has_attached_file :zip_file, path: s3_path
validates_attachment :zip_file,
content_type: { content_type: 'application/zip' }
end