Open kostrub opened 4 years ago
Happy to merge a PR with the fix.
This problem could have never been caught with a simple test. Because of this return
statement https://github.com/h2non/filetype.py/blob/master/filetype/match.py#L33 the matches (and probably also the performance) depend on the position of the Type
class in the list.
Shouldn't the matcher iterate over all possible types and throw an error if more than one match is found?
Hello. I have a problem when trying to process Cr2 files. filetype recognize it as both tiff and cr2 type. It's not surprise since cr2 basen on tiff .
Filetype version 1.0.7 Sample code:
Result is:
Should be:
You can take sample cr2 here I think to solve this problem we need to add something like
and not(buf[8] == 0x43 and buf[9] == 0x52)
here to make sure that there is no Cr2 magic word in buffer.