diff options
| author | Rapptz <[email protected]> | 2020-07-21 22:56:51 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2020-07-21 22:56:51 -0400 |
| commit | 4de01212a49e3957319e769622bc8f2da10494bb (patch) | |
| tree | 4cb644868f38375a175ec18f11faad6b18e385e0 | |
| parent | Don't use a namedtuple for _Overwrites (diff) | |
| download | discord.py-4de01212a49e3957319e769622bc8f2da10494bb.tar.xz discord.py-4de01212a49e3957319e769622bc8f2da10494bb.zip | |
Fix detection of some JPEG images without JFIF or Exif info
Closes #5143
| -rw-r--r-- | discord/utils.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/discord/utils.py b/discord/utils.py index a6f3897e..c1d6c69e 100644 --- a/discord/utils.py +++ b/discord/utils.py @@ -299,7 +299,7 @@ def _get_as_snowflake(data, key): def _get_mime_type_for_image(data): if data.startswith(b'\x89\x50\x4E\x47\x0D\x0A\x1A\x0A'): return 'image/png' - elif data[6:10] in (b'JFIF', b'Exif'): + elif data[0:3] == b'\xff\xd8\xff' or data[6:10] in (b'JFIF', b'Exif'): return 'image/jpeg' elif data.startswith((b'\x47\x49\x46\x38\x37\x61', b'\x47\x49\x46\x38\x39\x61')): return 'image/gif' |