From 1e30e164fa99289ab65b9bac57d25fed42d9126a Mon Sep 17 00:00:00 2001 From: Fabian Kropfhamer <54098356+fkropfhamer@users.noreply.github.com> Date: Tue, 22 Dec 2020 18:17:55 +0100 Subject: [PATCH] Update tweepy/api.py Co-authored-by: Harmon --- tweepy/api.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tweepy/api.py b/tweepy/api.py index 0df8da3..66e95d2 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -220,10 +220,12 @@ class API(object): :allowed_param: """ f = kwargs.pop('file', None) + h = None - if f: + if f is not None: + location = f.tell() h = f.read(32) - + f.seek(location) file_type = imghdr.what(filename, h=h) or mimetypes.guess_type(filename)[0] if file_type == 'gif': max_size = 14649 -- 2.25.1