Skip to content

Commit

Permalink
Fix ogg vorbis files with a cover art not being correctly processed (m…
Browse files Browse the repository at this point in the history
  • Loading branch information
ClearlyClaire authored and Mage committed Jan 14, 2022
1 parent e4c40a7 commit daa3aa7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/paperclip/media_type_spoof_detector_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@

module Paperclip
module MediaTypeSpoofDetectorExtensions
def calculated_content_type
@calculated_content_type ||= type_from_mime_magic || type_from_file_command
def mapping_override_mismatch?
!Array(mapped_content_type).include?(calculated_content_type) && !Array(mapped_content_type).include?(type_from_mime_magic)
end

def calculated_media_type_from_mime_magic
@calculated_media_type_from_mime_magic ||= type_from_mime_magic.split('/').first
end

def calculated_type_mismatch?
!media_types_from_name.include?(calculated_media_type) && !media_types_from_name.include?(calculated_media_type_from_mime_magic)
end

def type_from_mime_magic
Expand Down

0 comments on commit daa3aa7

Please sign in to comment.