aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2019-02-23 10:25:05 -0500
committerRapptz <[email protected]>2019-02-23 10:25:05 -0500
commit7d877e906714c299f52f1a34034ea94ef2202ca3 (patch)
treebf2916d8cfe2736de278f0e5881b8b3cdfc73c0b
parentUpdate copyright years. (diff)
downloaddiscord.py-7d877e906714c299f52f1a34034ea94ef2202ca3.tar.xz
discord.py-7d877e906714c299f52f1a34034ea94ef2202ca3.zip
Better jpeg detection in utils._get_mime_type_for_image
Fixes #1901
-rw-r--r--discord/utils.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/discord/utils.py b/discord/utils.py
index 841e8df9..acb62798 100644
--- a/discord/utils.py
+++ b/discord/utils.py
@@ -249,7 +249,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.startswith(b'\xFF\xD8') and data.rstrip(b'\0').endswith(b'\xFF\xD9'):
+ elif 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'