summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvoisin2013-04-29 22:56:30 +0200
committerjvoisin2013-04-29 22:56:30 +0200
commitac82b5fb712cbc0c80d4f6fb7c11bae70eea78e5 (patch)
tree56bd5d9c8a22dd967ede07e2a5f7b53fe42293f2
parentd7a6ca39fea4d362bf4489349398bb5f81a890a7 (diff)
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.
-rw-r--r--MAT/mat.py3
1 files changed, 2 insertions, 1 deletions
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):
144 mime = parser.mime_type 144 mime = parser.mime_type
145 145
146 if mime == 'application/zip': # some formats are zipped stuff 146 if mime == 'application/zip': # some formats are zipped stuff
147 mime = mimetypes.guess_type(name)[0] 147 if mimetypes.guess_type(name)[0] is not None:
148 mime = mimetypes.guess_type(name)[0]
148 149
149 if mime.startswith('application/vnd.oasis.opendocument'): 150 if mime.startswith('application/vnd.oasis.opendocument'):
150 mime = 'application/opendocument' # opendocument fileformat 151 mime = 'application/opendocument' # opendocument fileformat