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 <l@veriny.tf>
This commit is contained in:
SunDwarf 2017-01-08 15:59:27 +00:00
parent d13df30e2a
commit e7c5ef181f
No known key found for this signature in database
GPG Key ID: FE8BF5540067257C

View File

@ -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')