A platform for community discussion. Free, open, simple.
FIX: Do not optimize uploaded custom emoji (#11203)
Bianca Nenciu2910996feb14
diff --git a/lib/upload_creator.rb b/lib/upload_creator.rbindex 8174be1b7ea..1b37f47e79c 100644--- a/lib/upload_creator.rb+++ b/lib/upload_creator.rb@@ -371,6 +371,8 @@ class UploadCreatorenddef should_crop?+ return false if @opts[:type] == 'custom_emoji' && animated?(@file)+TYPES_TO_CROP.include?(@opts[:type])enddiff --git a/spec/lib/upload_creator_spec.rb b/spec/lib/upload_creator_spec.rbindex 8528a10087c..f1f0787737f 100644--- a/spec/lib/upload_creator_spec.rb+++ b/spec/lib/upload_creator_spec.rb@@ -443,6 +443,21 @@ RSpec.describe UploadCreator doendendend++ context 'custom emojis' do+ let(:animated_filename) { "animated.gif" }+ let(:animated_file) { file_from_fixtures(animated_filename) }++ it 'should not be cropped if animated' do+ upload = UploadCreator.new(animated_file, animated_filename,+ force_optimize: true,+ type: 'custom_emoji'+ ).create_for(user.id)++ expect(upload.animated).to eq(true)+ expect(FastImage.size(Discourse.store.path_for(upload))).to eq([320, 320])+ end+ endenddescribe '#clean_svg!' do