Try/catch magic for #207.

This commit is contained in:
Gwyn Ciesla 2019-11-21 12:34:58 -06:00
pare 995de2c6f9
commit a9913527eb

Veure arxiu

@ -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