diff options
author | Mohamad Mansour <66031317+mohamadmansourX@users.noreply.github.com> | 2021-07-20 18:56:57 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-20 18:56:57 (GMT) |
commit | 3b56b3b97d91e2b412ce1b2bcaddcd43ef3d223b (patch) | |
tree | fb444a949aef36f18b00b457b2fefdcba24c0023 /Lib/imghdr.py | |
parent | 6564656495d456a1bcc1aaa06abfc696209f37b2 (diff) | |
download | cpython-3b56b3b97d91e2b412ce1b2bcaddcd43ef3d223b.zip cpython-3b56b3b97d91e2b412ce1b2bcaddcd43ef3d223b.tar.gz cpython-3b56b3b97d91e2b412ce1b2bcaddcd43ef3d223b.tar.bz2 |
bpo-44539: Support recognizing JPEG files without JFIF or Exif markers (GH-26964)
Co-authored-by: moemansour03@gmail.com <m.mansour@tecfrac.com>
Co-authored-by: Éric Araujo <merwok@netwok.org>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Diffstat (limited to 'Lib/imghdr.py')
-rw-r--r-- | Lib/imghdr.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/imghdr.py b/Lib/imghdr.py index 6e01fd8..afcb677 100644 --- a/Lib/imghdr.py +++ b/Lib/imghdr.py @@ -35,9 +35,11 @@ def what(file, h=None): tests = [] def test_jpeg(h, f): - """JPEG data in JFIF or Exif format""" + """JPEG data with JFIF or Exif markers; and raw JPEG""" if h[6:10] in (b'JFIF', b'Exif'): return 'jpeg' + elif h[:4] == b'\xff\xd8\xff\xdb': + return 'jpeg' tests.append(test_jpeg) |