aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwyn Ciesla <[email protected]>2019-11-21 12:34:58 -0600
committerGwyn Ciesla <[email protected]>2019-11-21 12:34:58 -0600
commita9913527ebd74549157512fcd5417f50c4308f1e (patch)
tree6141db45e6e4112aee1aa45de949b02c99a862ad /mastodon
parent995de2c6f948035732e6e6658ca2a605796d6e90 (diff)
downloadmastodon.py-a9913527ebd74549157512fcd5417f50c4308f1e.tar.gz
Try/catch magic for #207.
Diffstat (limited to 'mastodon')
-rw-r--r--mastodon/Mastodon.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index 393d021..dc4fc03 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -3669,8 +3669,8 @@ class MastodonMalformedEventError(MastodonError):
3669 3669
3670def guess_type(media_file): 3670def guess_type(media_file):
3671 mime_type = None 3671 mime_type = None
3672 if magic: 3672 try:
3673 mime_type = magic.from_file(media_file, mime=True) 3673 mime_type = magic.from_file(media_file, mime=True)
3674 else: 3674 except AttributeError:
3675 mime_type = mimetypes.guess_type(media_file)[0] 3675 mime_type = mimetypes.guess_type(media_file)[0]
3676 return mime_type 3676 return mime_type
Powered by cgit v1.2.3 (git 2.41.0)