summaryrefslogtreecommitdiff
path: root/app/uploaders
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-02-11 10:14:32 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-02-11 10:14:32 +0200
commitab19196391f6383cd11a9f2f748bc2a90287fcc4 (patch)
tree837e7a3e761acf4d0f004fb4f387c7163f4e8cd4 /app/uploaders
parent2d83e43db0163028fddd54095a7f7260b3e5cc65 (diff)
downloadgitlab-ce-ab19196391f6383cd11a9f2f748bc2a90287fcc4.tar.gz
fix attachment uploader for aws
Diffstat (limited to 'app/uploaders')
-rw-r--r--app/uploaders/attachment_uploader.rb11
1 files changed, 10 insertions, 1 deletions
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