about summary refs log tree commit diff
path: root/config/initializers/paperclip.rb
diff options
context:
space:
mode:
authorEugen <eugen@zeonfederated.com>2017-03-15 22:55:22 +0100
committerGitHub <noreply@github.com>2017-03-15 22:55:22 +0100
commite245115f47082ffba27205f508301d14e792c369 (patch)
tree21a77b788dace45b734da6e64f1b0705016192f0 /config/initializers/paperclip.rb
parent620f70e42c16c324459ca2da52c68f1def8683de (diff)
parentc1124228e857b0e85f5bf927d2c41c7fadfdf955 (diff)
Merge branch 'master' into mastodon-site-api
Diffstat (limited to 'config/initializers/paperclip.rb')
-rw-r--r--config/initializers/paperclip.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb
index 71a7b514e..580a3196e 100644
--- a/config/initializers/paperclip.rb
+++ b/config/initializers/paperclip.rb
@@ -2,6 +2,11 @@
 
 Paperclip.options[:read_timeout] = 60
 
+Paperclip.interpolates :filename do |attachment, style|
+  return attachment.original_filename if style == :original
+  [basename(attachment, style), extension(attachment, style)].delete_if(&:empty?).join('.')
+end
+
 if ENV['S3_ENABLED'] == 'true'
   Aws.eager_autoload!(services: %w(S3))