summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--magic/compat.py7
2 files changed, 7 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 0346a85..111565e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,4 @@ pip-selfcheck.json
pyvenv.cfg
*.pyc
*~
+dist/
diff --git a/magic/compat.py b/magic/compat.py
index e2d71ee..07fad45 100644
--- a/magic/compat.py
+++ b/magic/compat.py
@@ -245,7 +245,12 @@ none_magic.load()
def _create_filemagic(mime_detected, type_detected):
- mime_type, mime_encoding = mime_detected.split('; ')
+ splat = mime_detected.split('; ')
+ mime_type = splat[0]
+ if len(splat) == 2:
+ mime_encoding = splat[1]
+ else:
+ mime_encoding = ''
return FileMagic(name=type_detected, mime_type=mime_type,
encoding=mime_encoding.replace('charset=', ''))