From e7c5ef181f0b6d3f7cfc9c85776b1d9a813e1de7 Mon Sep 17 00:00:00 2001 From: SunDwarf Date: Sun, 8 Jan 2017 15:59:27 +0000 Subject: [PATCH] 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 --- discord/utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/discord/utils.py b/discord/utils.py index 35a3034fc..0befa1cfa 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')