Commit ab191963 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

fix attachment uploader for aws

parent 2d83e43d
No related merge requests found
......@@ -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
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