mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 04:31:10 +08:00
FIX: Consider webp a supported image format for upload (#9015)
* Also fixes an issue where if webp was a downloaded hotlinked image and then secure + sent in an email, it was not being redacted because webp was not a supported media format in FileHelper * Webp originally removed as an image format in https://github.com/discourse/discourse/pull/6377 and there was a spec to make sure a .bin webp file did not get renamed from its type to webp. However we want to support webp images now to make sure they are properly redacted if secure media is on, so change the example in the spec to use tiff, another banned format, instead
This commit is contained in:
@ -79,12 +79,12 @@ RSpec.describe UploadCreator do
|
||||
expect(upload.original_filename).to eq('png_as.png')
|
||||
end
|
||||
|
||||
describe 'for webp format' do
|
||||
describe 'for tiff format' do
|
||||
before do
|
||||
SiteSetting.authorized_extensions = '.webp|.bin'
|
||||
SiteSetting.authorized_extensions = '.tiff|.bin'
|
||||
end
|
||||
|
||||
let(:filename) { "webp_as.bin" }
|
||||
let(:filename) { "tiff_as.bin" }
|
||||
let(:file) { file_from_fixtures(filename) }
|
||||
|
||||
it 'should not correct the coerce filename' do
|
||||
@ -96,7 +96,7 @@ RSpec.describe UploadCreator do
|
||||
|
||||
expect(upload.extension).to eq('bin')
|
||||
expect(File.extname(upload.url)).to eq('.bin')
|
||||
expect(upload.original_filename).to eq('webp_as.bin')
|
||||
expect(upload.original_filename).to eq('tiff_as.bin')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user