about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-06-18 17:27:05 +0200
committerGitHub <noreply@github.com>2018-06-18 17:27:05 +0200
commit50689f0d41b1f02c2d26c353571dfd15d8a4f186 (patch)
tree3ed161fe228418585ad50cfc528f71a59a155d6b
parent7e9e7c642d4cf5a5be9f2d5082282dab964b677e (diff)
Create special case to prefer "jpeg" over "jpe" file extension (#7841)
-rw-r--r--app/models/concerns/attachmentable.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/concerns/attachmentable.rb b/app/models/concerns/attachmentable.rb
index 6f8489b89..db63c3eca 100644
--- a/app/models/concerns/attachmentable.rb
+++ b/app/models/concerns/attachmentable.rb
@@ -41,7 +41,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'
 
-    extensions_for_mime_type.include?(original_extension) ? original_extension : extensions_for_mime_type.first
+    extensions_for_mime_type.include?(original_extension) ? original_extension : proper_extension
   end
 end