aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2018-11-26 11:21:03 +0100
committerGitHub <[email protected]>2018-11-26 11:21:03 +0100
commit62bf6afd9fbffc1d47c00eb496a03b3598c66ed3 (patch)
tree8727dbdfd6a6d6dbf7716601f80a33bbddf023f8 /mastodon/Mastodon.py
parent1956b1884518857ca2160546bade82524fe3c587 (diff)
parentaabbfa86bf51335a4e9c961df248c4cfbd606ae2 (diff)
downloadmastodon.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
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)