rails / marcel

Find the mime type of files, examining file, filename and declared type
Apache License 2.0
387 stars 67 forks source link

Identify Sony and Canon raw images as subtypes of image/tiff #89

Closed afcapel closed 9 months ago

afcapel commented 1 year ago

For Sony and Canon Raw file formats. They are based on the tiff format and have the same magic number data so they are incorrectly classified as tiff images.

Defining them as subtypes of tiff solves this issue:

Marcel::MimeType.for Pathname.new("/Users/afcapel/Downloads/RAW_SONY_ILCE-7M2.ARW"), name: "/Users/afcapel/Downloads/RAW_SONY_ILCE-7M2.ARW"
=> "image/x-raw-sony"