about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2018-09-17 20:24:46 +0200
committerEugen Rochko <eugen@zeonfederated.com>2018-09-17 20:24:46 +0200
commit9b32898e3c9e9284baa0792d0d7ee5723c860c4f (patch)
tree81629baa523ebc1c7ff5fcd245434a8cc0f28ba0 /lib
parentd16c3342cef767c88acde8e78d3321c5b17dd85f (diff)
Unconditionally re-encode locally-uploaded images to strip metadata (#8714)
This strips metadata on file upload by re-encoding the files, at the cost
of possible slight image quality decrease and processing resources.
Diffstat (limited to 'lib')
-rw-r--r--lib/paperclip/lazy_thumbnail.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/paperclip/lazy_thumbnail.rb b/lib/paperclip/lazy_thumbnail.rb
index ea675a5bf..542c17fb2 100644
--- a/lib/paperclip/lazy_thumbnail.rb
+++ b/lib/paperclip/lazy_thumbnail.rb
@@ -20,7 +20,7 @@ module Paperclip
     private
 
     def needs_convert?
-      needs_different_geometry? || needs_different_format?
+      needs_different_geometry? || needs_different_format? || needs_metadata_stripping?
     end
 
     def needs_different_geometry?
@@ -31,5 +31,9 @@ module Paperclip
     def needs_different_format?
       @format.present? && @current_format != @format
     end
+
+    def needs_metadata_stripping?
+      @attachment.instance.respond_to?(:local?) && @attachment.instance.local?
+    end
   end
 end