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
This commit is contained in:
commit
62bf6afd9f
S'han modificat 1 arxius amb 2 adicions i 0 eliminacions
|
@ -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'
|
||||
|
|
Loading…
Referencia en una nova incidència