From a9913527ebd74549157512fcd5417f50c4308f1e Mon Sep 17 00:00:00 2001 From: Gwyn Ciesla Date: Thu, 21 Nov 2019 12:34:58 -0600 Subject: Try/catch magic for #207. --- mastodon/Mastodon.py | 4 ++-- 1 file 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): def guess_type(media_file): mime_type = None - if magic: + try: mime_type = magic.from_file(media_file, mime=True) - else: + except AttributeError: mime_type = mimetypes.guess_type(media_file)[0] return mime_type -- cgit v1.2.3