diff options
author | errbufferoverfl <[email protected]> | 2018-09-14 17:16:12 +1000 |
---|---|---|
committer | errbufferoverfl <[email protected]> | 2018-09-14 17:16:12 +1000 |
commit | aabbfa86bf51335a4e9c961df248c4cfbd606ae2 (patch) | |
tree | e03e056136370886d04193aae60754176e6b577d | |
parent | 191ad84cef0b37e8d8a708812336858d447304c5 (diff) | |
download | mastodon.py-aabbfa86bf51335a4e9c961df248c4cfbd606ae2.tar.gz |
Adds statement to open file if MIME type is set and file exists
-rw-r--r-- | mastodon/Mastodon.py | 2 |
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' |