From ac82b5fb712cbc0c80d4f6fb7c11bae70eea78e5 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Mon, 29 Apr 2013 22:56:30 +0200 Subject: Fix incorrect handling of ziped formats formats The previous behavior was to use python's mimetype module on ziped format, to guess what type of file it precisely is. But sometimes, this fail. This commit fix this corner-case. --- MAT/mat.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MAT/mat.py b/MAT/mat.py index 8c92a33..af12466 100644 --- a/MAT/mat.py +++ b/MAT/mat.py @@ -144,7 +144,8 @@ def create_class_file(name, backup, **kwargs): mime = parser.mime_type if mime == 'application/zip': # some formats are zipped stuff - mime = mimetypes.guess_type(name)[0] + if mimetypes.guess_type(name)[0] is not None: + mime = mimetypes.guess_type(name)[0] if mime.startswith('application/vnd.oasis.opendocument'): mime = 'application/opendocument' # opendocument fileformat -- cgit v1.3