FEATURE: Support converting HEIF images to JPEG (#10079)

This commit is contained in:
Penar Musaraj
2020-07-22 21:40:09 -04:00
committed by GitHub
parent 10a6824e5f
commit 7559758e10
5 changed files with 53 additions and 0 deletions

View File

@@ -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") }