aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunDwarf <[email protected]>2017-01-08 15:59:27 +0000
committerSunDwarf <[email protected]>2017-01-08 15:59:27 +0000
commite7c5ef181f0b6d3f7cfc9c85776b1d9a813e1de7 (patch)
tree469a257df50119c2566e33da7d93bccb5b6068bf
parentAdd ability to edit guild invite splashes. (diff)
downloaddiscord.py-e7c5ef181f0b6d3f7cfc9c85776b1d9a813e1de7.tar.xz
discord.py-e7c5ef181f0b6d3f7cfc9c85776b1d9a813e1de7.zip
Allow uploading of GIFs for users.
Discord Nitro accounts can upload GIFs as avatars, so the image mimetype checker code should check for the GIF magic number too. Signed-off-by: SunDwarf <[email protected]>
-rw-r--r--discord/utils.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/discord/utils.py b/discord/utils.py
index 35a3034f..0befa1cf 100644
--- a/discord/utils.py
+++ b/discord/utils.py
@@ -246,6 +246,8 @@ def _get_mime_type_for_image(data):
return 'image/png'
elif data.startswith(b'\xFF\xD8') and data.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'
else:
raise InvalidArgument('Unsupported image type given')