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:
Martin Brennan
2020-02-21 13:08:02 +10:00
committed by GitHub
parent 6a2bde4d48
commit 3af2670bd5
5 changed files with 7 additions and 7 deletions

View File

@ -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