mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Support converting HEIF images to JPEG (#10079)
This commit is contained in:
@@ -170,6 +170,28 @@ RSpec.describe UploadCreator do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'converting HEIF to jpeg' do
|
||||
let(:filename) { "should_be_jpeg.heic" }
|
||||
let(:file) { file_from_fixtures(filename, "images") }
|
||||
|
||||
before do
|
||||
SiteSetting.convert_heif_to_jpeg = true
|
||||
SiteSetting.authorized_extensions = 'jpg|heic'
|
||||
end
|
||||
|
||||
it 'should store the upload with the right extension' 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('jpeg')
|
||||
expect(File.extname(upload.url)).to eq('.jpeg')
|
||||
expect(upload.original_filename).to eq('should_be_jpeg.jpg')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'secure attachments' do
|
||||
let(:filename) { "small.pdf" }
|
||||
let(:file) { file_from_fixtures(filename, "pdf") }
|
||||
|
||||
Reference in New Issue
Block a user