about summary refs log tree commit diff
path: root/config/initializers
diff options
context:
space:
mode:
authorEugen <eugen@zeonfederated.com>2017-04-18 23:15:44 +0200
committerGitHub <noreply@github.com>2017-04-18 23:15:44 +0200
commite09ab2c0bdc0822886fa98b0019d4a447a2ee0d6 (patch)
tree200e0b252beaf08b94c497ced036fea120422912 /config/initializers
parent6bd101923567a7302c2b734317791f941ce53cdf (diff)
Fix #1642, fix #1912 - Dictate content-type file extension (#2078)
* Fix #1642, fix #1912 - Previous change (#1718) did not modify how original file was saved on upload

* Fix for when file is missing
Diffstat (limited to 'config/initializers')
-rw-r--r--config/initializers/paperclip.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb
index 77bc13b3a..ffaa2566e 100644
--- a/config/initializers/paperclip.rb
+++ b/config/initializers/paperclip.rb
@@ -4,7 +4,7 @@ Paperclip.options[:read_timeout] = 60
 
 Paperclip.interpolates :filename do |attachment, style|
   return attachment.original_filename if style == :original
-  [basename(attachment, style), content_type_extension(attachment, style)].delete_if(&:empty?).join('.')
+  [basename(attachment, style), extension(attachment, style)].delete_if(&:empty?).join('.')
 end
 
 if ENV['S3_ENABLED'] == 'true'
@@ -39,6 +39,6 @@ if ENV['S3_ENABLED'] == 'true'
     Paperclip::Attachment.default_options[:s3_host_alias] = ENV['S3_CLOUDFRONT_HOST']
   end
 else
-  Paperclip::Attachment.default_options[:path]           = (ENV['PAPERCLIP_ROOT_PATH'] || ':rails_root/public/system') + '/:class/:attachment/:id_partition/:style/:filename'
-  Paperclip::Attachment.default_options[:url]            = (ENV['PAPERCLIP_ROOT_URL'] || '/system') + '/:class/:attachment/:id_partition/:style/:filename'
+  Paperclip::Attachment.default_options[:path] = (ENV['PAPERCLIP_ROOT_PATH'] || ':rails_root/public/system') + '/:class/:attachment/:id_partition/:style/:filename'
+  Paperclip::Attachment.default_options[:url]  = (ENV['PAPERCLIP_ROOT_URL'] || '/system') + '/:class/:attachment/:id_partition/:style/:filename'
 end