Skip to content
This repository was archived by the owner on Aug 7, 2024. It is now read-only.

Commit 2f896ec

Browse files
committed
change for GIF sizers
1 parent 0212d81 commit 2f896ec

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

twitter/twitter_utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,11 @@ def parse_media_file(passed_media, async_upload=False):
204204
"""
205205
img_formats = ['image/jpeg',
206206
'image/png',
207-
'image/gif',
208207
'image/bmp',
209208
'image/webp']
209+
long_img_formats = [
210+
'image/gif'
211+
]
210212
video_formats = ['video/mp4',
211213
'video/quicktime']
212214

@@ -241,11 +243,13 @@ def parse_media_file(passed_media, async_upload=False):
241243
if media_type is not None:
242244
if media_type in img_formats and file_size > 5 * 1048576:
243245
raise TwitterError({'message': 'Images must be less than 5MB.'})
246+
elif media_type in long_img_formats and file_size > 15 * 1048576:
247+
raise TwitterError({'message': 'GIF Image must be less than 15MB.'})
244248
elif media_type in video_formats and not async_upload and file_size > 15 * 1048576:
245249
raise TwitterError({'message': 'Videos must be less than 15MB.'})
246250
elif media_type in video_formats and async_upload and file_size > 512 * 1048576:
247251
raise TwitterError({'message': 'Videos must be less than 512MB.'})
248-
elif media_type not in img_formats and media_type not in video_formats:
252+
elif media_type not in img_formats and media_type not in video_formats and media_type not in long_img_formats:
249253
raise TwitterError({'message': 'Media type could not be determined.'})
250254

251255
return data_file, filename, file_size, media_type

0 commit comments

Comments
 (0)