Skip to content

Commit afe7005

Browse files
authored
Merge pull request #688 from AnswerDotAI/jpeg-test-fix
test jpeg with COM segment
2 parents 90771e1 + 9ecdcf5 commit afe7005

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fastcore/imghdr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ def what(file, h=None):
3636
tests = []
3737

3838
def test_jpeg(h, f):
39-
"""JPEG data with JFIF or Exif markers; and raw JPEG"""
40-
if h[6:10] in (b'JFIF', b'Exif') or h[:4] in (b'\xff\xd8\xff\xdb',b'\xff\xd8\xff\xe2',b'\xff\xd8\xff\xe1'):
39+
"""JPEG data with JFIF or Exif markers; and raw JPEG including COM segments"""
40+
if h[6:10] in (b'JFIF', b'Exif') or h[:4] in (b'\xff\xd8\xff\xdb',b'\xff\xd8\xff\xe2',b'\xff\xd8\xff\xe1',b'\xff\xd8\xff\xfe'):
4141
return 'jpeg'
4242

4343
tests.append(test_jpeg)

0 commit comments

Comments
 (0)