diff options
author | Lorenz Diener <[email protected]> | 2018-11-26 11:21:03 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2018-11-26 11:21:03 +0100 |
commit | 62bf6afd9fbffc1d47c00eb496a03b3598c66ed3 (patch) | |
tree | 8727dbdfd6a6d6dbf7716601f80a33bbddf023f8 | |
parent | 1956b1884518857ca2160546bade82524fe3c587 (diff) | |
parent | aabbfa86bf51335a4e9c961df248c4cfbd606ae2 (diff) | |
download | mastodon.py-62bf6afd9fbffc1d47c00eb496a03b3598c66ed3.tar.gz |
Merge pull request #146 from errbufferoverfl/issue-145-providing-mime-type-raises-exception
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' |