aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerrbufferoverfl <[email protected]>2018-09-14 17:16:12 +1000
committererrbufferoverfl <[email protected]>2018-09-14 17:16:12 +1000
commitaabbfa86bf51335a4e9c961df248c4cfbd606ae2 (patch)
treee03e056136370886d04193aae60754176e6b577d /mastodon/Mastodon.py
parent191ad84cef0b37e8d8a708812336858d447304c5 (diff)
downloadmastodon.py-aabbfa86bf51335a4e9c961df248c4cfbd606ae2.tar.gz
Adds statement to open file if MIME type is set and file exists
Diffstat (limited to 'mastodon/Mastodon.py')
-rw-r--r--mastodon/Mastodon.py2
1 files changed, 2 insertions, 0 deletions
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:
1722 if mime_type is None and os.path.isfile(media_file): 1722 if mime_type is None and os.path.isfile(media_file):
1723 mime_type = mimetypes.guess_type(media_file)[0] 1723 mime_type = mimetypes.guess_type(media_file)[0]
1724 media_file = open(media_file, 'rb') 1724 media_file = open(media_file, 'rb')
1725 elif mime_type and os.path.isfile(media_file):
1726 media_file = open(media_file, 'rb')
1725 1727
1726 if mime_type is None: 1728 if mime_type is None:
1727 raise MastodonIllegalArgumentError('Could not determine mime type' 1729 raise MastodonIllegalArgumentError('Could not determine mime type'
Powered by cgit v1.2.3 (git 2.41.0)