aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkhazhyk <[email protected]>2017-07-24 21:37:46 -0700
committerRapptz <[email protected]>2017-07-25 06:09:41 -0400
commit0a588fac1c82d9c259eb56f0ec15d23b6f9a0989 (patch)
tree81c0881912911d40da7856fe73b0f422076e85d4
parentadd Guild.icon_url_as (diff)
downloaddiscord.py-0a588fac1c82d9c259eb56f0ec15d23b6f9a0989.tar.xz
discord.py-0a588fac1c82d9c259eb56f0ec15d23b6f9a0989.zip
allow trailing null bytes in uploaded jpegs
-rw-r--r--discord/utils.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/discord/utils.py b/discord/utils.py
index d7b04503..9efb1bf8 100644
--- a/discord/utils.py
+++ b/discord/utils.py
@@ -242,7 +242,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.endswith(b'\xFF\xD9'):
+ elif data.startswith(b'\xFF\xD8') and data.rstrip(b'\0').endswith(b'\xFF\xD9'):
return 'image/jpeg'
elif data.startswith(b'\x47\x49\x46\x38\x37\x61') or data.startswith(b'\x47\x49\x46\x38\x39\x61'):
return 'image/gif'