Shorten JPEG pattern to match E2 tag suffix
sebluy opened this issue · comments
Hello!
I recently encountered a JPEG image with the tag FFD8FFE2, which does not match the pattern for the JPEG matcher. Because of this, the image encounters a decode error when using Intervention/Image.
mimesniffer/src/Types/ImageJpeg.php
Line 21 in 030c506
All other applications I tried recognize the image as a JPEG, and as I understand it, only the first part of the tag (FFD8FF) is required to indicate the image is a JPEG. I'm curious as to why there's extra restriction in the regex, and if it's necessary.
Let me now if it would be possible to shorten the pattern to match more tags. It seems like it should be:
protected $pattern = "/^FFD8FF/";
The issue still exists. By the way, I consider that it can be fixed by extending the pattern with "E2" "E3" and "E8", instead of decreasing the pattern size