src/pyams_file/file.py
changeset 35 57b510d3cbe4
parent 34 47dd5b37fab5
child 47 30e0a305f75f
--- a/src/pyams_file/file.py	Sun May 21 01:50:16 2017 +0200
+++ b/src/pyams_file/file.py	Tue Jun 06 17:30:16 2017 +0200
@@ -208,7 +208,7 @@
         if hasattr(magic, 'detect_from_content'):
             result = magic.detect_from_content(input)
             if result:
-                return result.mime_type.encode()
+                return result.mime_type
         elif hasattr(magic, 'from_buffer'):
             return magic.from_buffer(input, mime=True)
     else:
@@ -222,11 +222,11 @@
     content-type recognition
     """
     content_type = get_magic_content_type(data)
-    if content_type.startswith(b'image/'):
+    if content_type.startswith('image/'):
         factory = ImageFile
-    elif content_type.startswith(b'video/'):
+    elif content_type.startswith('video/'):
         factory = VideoFile
-    elif content_type.startswith(b'audio/'):
+    elif content_type.startswith('audio/'):
         factory = AudioFile
     else:
         factory = File