Make the paperclip filename interpolator smarter about the :original style
If an :original gets converted into another format, it would get saved as original_filename *anyway*, so generating the extension is pointless and yields bad results for when you change the style definition later. This way, old gifs will still have correct URLs
This commit is contained in:
parent
c911ade272
commit
65b49d95b7
1 changed files with 5 additions and 0 deletions
|
@ -2,6 +2,11 @@
|
||||||
|
|
||||||
Paperclip.options[:read_timeout] = 60
|
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'
|
if ENV['S3_ENABLED'] == 'true'
|
||||||
Aws.eager_autoload!(services: %w(S3))
|
Aws.eager_autoload!(services: %w(S3))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue