A platform for community discussion. Free, open, simple.
Drop `tif`, `tiff`, `webp` and `bmp` from supported images.
Guo Xiang Tan71caf7521d21
diff --git a/lib/file_helper.rb b/lib/file_helper.rbindex 331b2636d8f..f7d2a0907d8 100644--- a/lib/file_helper.rb+++ b/lib/file_helper.rb@@ -101,7 +101,7 @@ class FileHelperenddef self.supported_images- @@supported_images ||= Set.new %w{jpg jpeg png gif tif tiff bmp svg webp ico}+ @@supported_images ||= Set.new %w{jpg jpeg png gif svg ico}enddef self.supported_images_regexpdiff --git a/spec/fixtures/images/webp_as.bin b/spec/fixtures/images/webp_as.binnew file mode 100644index 00000000000..2f8bf8fa1abBinary files /dev/null and b/spec/fixtures/images/webp_as.bin differdiff --git a/spec/lib/upload_creator_spec.rb b/spec/lib/upload_creator_spec.rbindex 614916ec4fd..827288abb7b 100644--- a/spec/lib/upload_creator_spec.rb+++ b/spec/lib/upload_creator_spec.rb@@ -43,6 +43,27 @@ RSpec.describe UploadCreator doexpect(File.extname(upload.url)).to eq('.png')expect(upload.original_filename).to eq('png_as.png')end++ describe 'for webp format' do+ before do+ SiteSetting.authorized_extensions = '.webp|.bin'+ end++ let(:filename) { "webp_as.bin" }+ let(:file) { file_from_fixtures(filename) }++ it 'should not correct the coerce filename' do+ expect do+ UploadCreator.new(file, filename).create_for(user.id)+ end.to change { Upload.count }.by(1)++ upload = Upload.last++ expect(upload.extension).to eq('bin')+ expect(File.extname(upload.url)).to eq('.bin')+ expect(upload.original_filename).to eq('webp_as.bin')+ end+ endenddescribe 'converting to jpeg' do