From cc9480b24af177108a71a5310b9f876bea128a8a Mon Sep 17 00:00:00 2001 From: Alan Guo Xiang Tan Date: Fri, 16 Feb 2024 07:39:49 +0800 Subject: [PATCH] PERF: Use `-ping` option to ImageMagick `identify` command (#25713) Why this change? This adds the `-ping` option to the spots we missed in cfdb461e9a4e791dfa604cfb14be503c0932481e. --- app/models/upload.rb | 1 + spec/lib/upload_creator_spec.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/upload.rb b/app/models/upload.rb index 5b02962a3a4..665ac847ed3 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -414,6 +414,7 @@ class Upload < ActiveRecord::Base begin Discourse::Utils.execute_command( "identify", + "-ping", "-format", "%Q", local_path, diff --git a/spec/lib/upload_creator_spec.rb b/spec/lib/upload_creator_spec.rb index a340c029aa6..e6f93f20fba 100644 --- a/spec/lib/upload_creator_spec.rb +++ b/spec/lib/upload_creator_spec.rb @@ -147,7 +147,7 @@ RSpec.describe UploadCreator do describe "converting to jpeg" do def image_quality(path) local_path = File.join(Rails.root, "public", path) - Discourse::Utils.execute_command("identify", "-format", "%Q", local_path).to_i + Discourse::Utils.execute_command("identify", "-ping", "-format", "%Q", local_path).to_i end let(:filename) { "should_be_jpeg.png" }