BigW Consortium Gitlab

Commit ab191963 by Dmitriy Zaporozhets

fix attachment uploader for aws

parent 2d83e43d
...@@ -8,6 +8,15 @@ class AttachmentUploader < CarrierWave::Uploader::Base ...@@ -8,6 +8,15 @@ class AttachmentUploader < CarrierWave::Uploader::Base
end end
def image? 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
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment