Fix invalid Content-Type header for WebP images (#26773)
parent
1f92436745
commit
ea31929776
|
@ -1,6 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# Be sure to restart your server when you modify this file.
|
|
||||||
|
|
||||||
Mime::Type.register 'application/json', :json, %w(text/x-json application/jsonrequest application/jrd+json application/activity+json application/ld+json)
|
Mime::Type.register 'application/json', :json, %w(text/x-json application/jsonrequest application/jrd+json application/activity+json application/ld+json)
|
||||||
Mime::Type.register 'text/xml', :xml, %w(application/xml application/atom+xml application/xrd+xml)
|
Mime::Type.register 'text/xml', :xml, %w(application/xml application/atom+xml application/xrd+xml)
|
||||||
|
|
||||||
|
# WebP is not defined in Rack 2.2.
|
||||||
|
Rack::Mime::MIME_TYPES['.webp'] = 'image/webp'
|
||||||
|
|
|
@ -105,6 +105,9 @@ RSpec.describe MediaAttachment, paperclip_processing: true do
|
||||||
|
|
||||||
# sets file extension
|
# sets file extension
|
||||||
expect(media.file_file_name).to end_with extension
|
expect(media.file_file_name).to end_with extension
|
||||||
|
|
||||||
|
# Rack::Mime (used by PublicFileServerMiddleware) recognizes file extension
|
||||||
|
expect(Rack::Mime.mime_type(extension, nil)).to eq content_type
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'saves media attachment with correct size metadata' do
|
it 'saves media attachment with correct size metadata' do
|
||||||
|
|
Reference in New Issue