PR/7: Return the proper ValueError message
authorChristos Zoulas <christos@zoulas.com>
Sat, 23 Jun 2018 14:57:53 +0000 (14:57 +0000)
committerChristos Zoulas <christos@zoulas.com>
Sat, 23 Jun 2018 14:57:53 +0000 (14:57 +0000)
python/magic.py

index 662569e889d0441cd3df7853ab6d8f28b7b3ac86..377b55526b740d8f41360bdec40c81e1f48afed4 100644 (file)
@@ -248,7 +248,10 @@ none_magic.load()
 
 
 def _create_filemagic(mime_detected, type_detected):
-    mime_type, mime_encoding = mime_detected.split('; ')
+    try:
+       mime_type, mime_encoding = mime_detected.split('; ')
+    except ValueError:
+       raise ValueError(mime_detected)
 
     return FileMagic(name=type_detected, mime_type=mime_type,
                      encoding=mime_encoding.replace('charset=', ''))