From aabbfa86bf51335a4e9c961df248c4cfbd606ae2 Mon Sep 17 00:00:00 2001 From: errbufferoverfl Date: Fri, 14 Sep 2018 17:16:12 +1000 Subject: Adds statement to open file if MIME type is set and file exists --- mastodon/Mastodon.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mastodon') diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index e6d8268..7f0f0fd 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -1722,6 +1722,8 @@ class Mastodon: if mime_type is None and os.path.isfile(media_file): mime_type = mimetypes.guess_type(media_file)[0] media_file = open(media_file, 'rb') + elif mime_type and os.path.isfile(media_file): + media_file = open(media_file, 'rb') if mime_type is None: raise MastodonIllegalArgumentError('Could not determine mime type' -- cgit v1.2.3