about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-06-24 14:32:22 +0200
committerThibaut Girka <thib@sitedethib.com>2018-06-24 14:32:22 +0200
commit4b0f27ba7822befed76f8368b472c6ade6977cb2 (patch)
treecebf03387c15cb6299d27a7988f78d173d7945de /app/models
parent03cfe366fd0146cb4c3ede4dcdeeb2228a513e7d (diff)
parent50a2854f922ebdd2c056870a0de402329bdf1bb3 (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Diffstat (limited to 'app/models')
-rw-r--r--app/models/concerns/attachmentable.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/models/concerns/attachmentable.rb b/app/models/concerns/attachmentable.rb
index db63c3eca..44bdfa39a 100644
--- a/app/models/concerns/attachmentable.rb
+++ b/app/models/concerns/attachmentable.rb
@@ -42,8 +42,9 @@ module Attachmentable
     extensions_for_mime_type = mime_type.empty? ? [] : mime_type.first.extensions
     original_extension       = Paperclip::Interpolations.extension(attachment, :original)
     proper_extension         = extensions_for_mime_type.first.to_s
-    proper_extension         = 'jpeg' if proper_extension == 'jpe'
+    extension                = extensions_for_mime_type.include?(original_extension) ? original_extension : proper_extension
+    extension                = 'jpeg' if extension == 'jpe'
 
-    extensions_for_mime_type.include?(original_extension) ? original_extension : proper_extension
+    extension
   end
 end