diff options
author | Lorenz Diener <[email protected]> | 2020-02-15 13:51:59 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-15 13:51:59 +0100 |
commit | 4e76f6e322a547aa21c6ee755a9ea35e25e01ff4 (patch) | |
tree | dca59479851c6c2d06e27c48236be4d898b08430 | |
parent | 0be9419c674bd11c0ab1e3b16ef65411c7127434 (diff) | |
parent | a9913527ebd74549157512fcd5417f50c4308f1e (diff) | |
download | mastodon.py-4e76f6e322a547aa21c6ee755a9ea35e25e01ff4.tar.gz |
Merge pull request #208 from limburgher/master
Try/catch magic for #207.
-rw-r--r-- | mastodon/Mastodon.py | 4 |
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 | ||
3673 | def guess_type(media_file): | 3673 | def 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 |