aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2020-02-15 13:51:59 +0100
committerGitHub <[email protected]>2020-02-15 13:51:59 +0100
commit4e76f6e322a547aa21c6ee755a9ea35e25e01ff4 (patch)
treedca59479851c6c2d06e27c48236be4d898b08430
parent0be9419c674bd11c0ab1e3b16ef65411c7127434 (diff)
parenta9913527ebd74549157512fcd5417f50c4308f1e (diff)
downloadmastodon.py-4e76f6e322a547aa21c6ee755a9ea35e25e01ff4.tar.gz
Merge pull request #208 from limburgher/master
Try/catch magic for #207.
-rw-r--r--mastodon/Mastodon.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index 0d1750f..7615d82 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -3672,8 +3672,8 @@ class MastodonMalformedEventError(MastodonError):
3672 3672
3673def guess_type(media_file): 3673def guess_type(media_file):
3674 mime_type = None 3674 mime_type = None
3675 if magic: 3675 try:
3676 mime_type = magic.from_file(media_file, mime=True) 3676 mime_type = magic.from_file(media_file, mime=True)
3677 else: 3677 except AttributeError:
3678 mime_type = mimetypes.guess_type(media_file)[0] 3678 mime_type = mimetypes.guess_type(media_file)[0]
3679 return mime_type 3679 return mime_type
Powered by cgit v1.2.3 (git 2.41.0)