[FIX] tools: add JFIF format signature to guess_mimetype

Some JPEG images in JFIF format were not uploaded as their binary
signature were not recognized.

Part of https://github.com/odoo/odoo/pull/71143
task-2502208

Part-of: odoo/odoo#71143
This commit is contained in:
Younn Olivier
2021-09-02 14:14:52 +00:00
committed by qsm-odoo
parent 56b70e16db
commit 06bded68b0
+2 -2
View File
@@ -117,8 +117,8 @@ _Entry = collections.namedtuple('_Entry', ['mimetype', 'signatures', 'discrimina
_mime_mappings = (
# pdf
_Entry('application/pdf', [b'%PDF'], []),
# jpg, jpeg, png, gif, bmp
_Entry('image/jpeg', [b'\xFF\xD8\xFF\xE0', b'\xFF\xD8\xFF\xE2', b'\xFF\xD8\xFF\xE3', b'\xFF\xD8\xFF\xE1'], []),
# jpg, jpeg, png, gif, bmp, jfif
_Entry('image/jpeg', [b'\xFF\xD8\xFF\xE0', b'\xFF\xD8\xFF\xE2', b'\xFF\xD8\xFF\xE3', b'\xFF\xD8\xFF\xE1', b'\xFF\xD8\xFF\xDB'], []),
_Entry('image/png', [b'\x89PNG\r\n\x1A\n'], []),
_Entry('image/gif', [b'GIF87a', b'GIF89a'], []),
_Entry('image/bmp', [b'BM'], []),