# HG changeset patch # User Thierry Florac # Date 1496763016 -7200 # Node ID 57b510d3cbe4ef6b6306074afae287b7d384f388 # Parent 47dd5b37fab5ea182d95377d72a8723079ea94f5 Use unicode strings for content type diff -r 47dd5b37fab5 -r 57b510d3cbe4 src/pyams_file/file.py --- 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