mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 17:04:59 +08:00
Drop tif
, tiff
, webp
and bmp
from supported images.
https://meta.discourse.org/t/cr2-raw-files-are-being-treated-as-tiff-files/96775/3?u=tgxworld
This commit is contained in:
@ -101,7 +101,7 @@ class FileHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.supported_images
|
def 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}
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.supported_images_regexp
|
def self.supported_images_regexp
|
||||||
|
BIN
spec/fixtures/images/webp_as.bin
vendored
Normal file
BIN
spec/fixtures/images/webp_as.bin
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 B |
@ -43,6 +43,27 @@ RSpec.describe UploadCreator do
|
|||||||
expect(File.extname(upload.url)).to eq('.png')
|
expect(File.extname(upload.url)).to eq('.png')
|
||||||
expect(upload.original_filename).to eq('png_as.png')
|
expect(upload.original_filename).to eq('png_as.png')
|
||||||
end
|
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
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'converting to jpeg' do
|
describe 'converting to jpeg' do
|
||||||
|
Reference in New Issue
Block a user