From 3387e363d584f56efac4b5019dd7fe670fb66175 Mon Sep 17 00:00:00 2001 From: JC Francois Date: Sun, 8 Sep 2019 20:01:26 +0200 Subject: [PATCH] Try to not specify mime_type to fix crash when mime_type is NoneType --- twoot.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/twoot.py b/twoot.py index f44f8de..d61aef1 100755 --- a/twoot.py +++ b/twoot.py @@ -314,15 +314,11 @@ def main(argv): # Download picture media = requests.get(photo) - # Fix to avoid media_post failing because mime_type is NoneType - # "Can only concatenate str to str" mime_type = media.headers['content-type'] - if type(mime_type) is None: - mime_type = "" # Upload picture to Mastodon instance try: - media_posted = mastodon.media_post(media.content, mime_type) + media_posted = mastodon.media_post(media.content) media_ids.append(media_posted['id']) except MastodonAPIError: # Media cannot be uploaded (invalid format, dead link, etc.) pass