##// END OF EJS Templates
Compatibility with python-magic of latest version (returts str, not bytes)
neko259 -
r1686:21e5d408 3.3.1 default
parent child Browse files
Show More
@@ -137,8 +137,9 b' def get_upload_filename(model_instance, '
137 137
138 138
139 139 def get_file_mimetype(file) -> str:
140 type = magic.from_buffer(file.chunks().__next__(), mime=True)
141 if type is not None:
142 return type.decode()
143 else:
144 return 'application/octet-stream'
140 file_type = magic.from_buffer(file.chunks().__next__(), mime=True)
141 if file_type is None:
142 file_type = 'application/octet-stream'
143 else if type(file_type) == bytes:
144 file_type = file_type.decode()
145 return type
General Comments 0
You need to be logged in to leave comments. Login now