diff --git a/app/uploaders/attachment_uploader.rb b/app/uploaders/attachment_uploader.rb index 391731d9470..3dbf2860bd4 100644 --- a/app/uploaders/attachment_uploader.rb +++ b/app/uploaders/attachment_uploader.rb @@ -8,6 +8,15 @@ class AttachmentUploader < CarrierWave::Uploader::Base end def image? - %w(png jpg jpeg).include?(file.extension) + img_ext = %w(png jpg jpeg) + if file.respond_to?(:extension) + img_ext.include?(file.extension) + else + # Not all CarrierWave storages respond to :extension + ext = file.path.split('.').last + img_ext.include?(ext) + end + rescue + false end end