-
Notifications
You must be signed in to change notification settings - Fork 445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Misidentifies jpeg as "audio/vnd.dts.hd" #36
Comments
FTR if I cut the file short (first 13,000 bytes) it works correctly:
So the gem is selecting based on the a worse match (a match somewhere between bytes 13000 and 18725) instead of a better one (first 2 or 3 bytes). |
data = File.binread('1470445_05.jpg')
MimeMagic::MAGIC.select {|type, matches| MimeMagic.send(:magic_match_str, data, matches) }
=> [["audio/vnd.dts.hd", [[0..18725, "dX %"]]], ["image/jpeg", [[0, "\xFF\xD8\xFF"], [0, "\xFF\xD8"]]]] So, this file does match the image/jpeg format, but |
Probably this is a flaw in the algorithm or in the priority order in the upstream freedesktop file. Maybe someone could take a look on how this could be done better or how other tools based on the freedesktop database operate? |
This issue should be solved by #40, because the |
I assume this is fixed? |
I have 10 photos.
file
andidentify
(imagemagick) think all are jpegs, however this gem classifies one of them incorrectly.I used the "magic" found here:
https://github.com/minad/mimemagic/blob/v0.3.0/lib/mimemagic/tables.rb#L1487
to verify:
The text was updated successfully, but these errors were encountered: