mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 13:51:18 +08:00
FIX: always test and coerce to image on upload
In the past the filename of the origin was used as the source for the extension of the file when optimizing on upload. We now use the actual calculated extension based on upload data.
This commit is contained in:
@ -26,7 +26,7 @@ RSpec.describe UploadCreator do
|
||||
end
|
||||
|
||||
describe 'when image has the wrong extension' do
|
||||
let(:filename) { "png_as.jpg" }
|
||||
let(:filename) { "png_as.bin" }
|
||||
let(:file) { file_from_fixtures(filename) }
|
||||
|
||||
it 'should store the upload with the right extension' do
|
||||
@ -41,7 +41,7 @@ RSpec.describe UploadCreator do
|
||||
|
||||
expect(upload.extension).to eq('png')
|
||||
expect(File.extname(upload.url)).to eq('.png')
|
||||
expect(upload.original_filename).to eq('png_as.jpg')
|
||||
expect(upload.original_filename).to eq('png_as.bin.fixed.png')
|
||||
end
|
||||
end
|
||||
|
||||
@ -65,7 +65,7 @@ RSpec.describe UploadCreator do
|
||||
|
||||
expect(upload.extension).to eq('jpeg')
|
||||
expect(File.extname(upload.url)).to eq('.jpeg')
|
||||
expect(upload.original_filename).to eq('logo.png')
|
||||
expect(upload.original_filename).to eq('logo.png.fixed.jpeg')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user