diff --git a/lib/upload_creator.rb b/lib/upload_creator.rb index e5c43dc0240..30b4ff99e6d 100644 --- a/lib/upload_creator.rb +++ b/lib/upload_creator.rb @@ -127,10 +127,14 @@ class UploadCreator if @image_info.type.to_s == 'svg' w, h = [0, 0] + # identify can behave differently depending on how it's compiled and + # what programs (e.g. inkscape) are installed on your system. + # 'MSVG:' forces ImageMagick to use internal routines and behave + # consistently whether it's running from our docker container or not begin w, h = Discourse::Utils - .execute_command("identify", "-ping", "-format", "%w %h", @file.path, timeout: Upload::MAX_IDENTIFY_SECONDS) - .split(' ') + .execute_command("identify", "-ping", "-format", "%w %h", "MSVG:#{@file.path}", timeout: Upload::MAX_IDENTIFY_SECONDS) + .split(' ').map(&:to_i) rescue # use default 0, 0 end