From c45a1af5e1f95f80245cfc8def01dc786362956a Mon Sep 17 00:00:00 2001 From: Ed Summers Date: Sun, 9 Apr 2017 17:56:28 -0400 Subject: [PATCH] fix ValueError checking if media_type is defined will short circuit the the call to os.path.isfile when content is supplied fixes #28 --- mastodon/Mastodon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 9967bdb..1ae888d 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -565,7 +565,7 @@ class Mastodon: Returns a media dict. This contains the id that can be used in status_post to attach the media file to a toot. """ - if os.path.isfile(media_file) and mime_type == None: + if mime_type == None and os.path.isfile(media_file): mime_type = mimetypes.guess_type(media_file)[0] media_file = open(media_file, 'rb')