A platform for community discussion. Free, open, simple.
SECURITY: force IM decoder based on file extension - part 2
Régis Hanol800c57c6abaf
diff --git a/app/models/optimized_image.rb b/app/models/optimized_image.rbindex 501efb401e1..01e6724dfea 100644--- a/app/models/optimized_image.rb+++ b/app/models/optimized_image.rb@@ -123,7 +123,7 @@ class OptimizedImage < ActiveRecord::Basedef self.prepend_decoder!(path)extension = File.extname(path)[1..-1]raise Discourse::InvalidAccess unless extension[IM_DECODERS]- "#{extension}:#{path}"+ path = "#{extension}:#{path}"enddef self.thumbnail_or_resizediff --git a/lib/upload_creator.rb b/lib/upload_creator.rbindex 207859dc515..ce22b9203b0 100644--- a/lib/upload_creator.rb+++ b/lib/upload_creator.rb@@ -166,12 +166,12 @@ class UploadCreator"convert",from,"-auto-orient",- "-background white",- "-interlace none",+ "-background", "white",+ "-interlace", "none","-flatten",- "-quality #{SiteSetting.png_to_jpg_quality}"+ "-quality", SiteSetting.png_to_jpg_quality.to_s]- command << "-debug all" if debug+ command << "-debug" << "all" if debugcommand << toDiscourse::Utils.execute_command(*command, failure_message: I18n.t("upload.png_to_jpg_conversion_failure_message"))