Skip the known extension check if mimetypes fails.

pull/2/head
Raphaël Vinot 2015-11-05 10:34:03 +01:00
parent 9079eac90a
commit b0d0912ff9
2 changed files with 2 additions and 2 deletions

View File

@ -109,7 +109,7 @@ class File(FileBase):
if aliases.get(mimetype) is not None:
mimetype = aliases.get(mimetype)
expected_extensions = mimetypes.guess_all_extensions(mimetype, strict=False)
if expected_extensions is not None:
if expected_extensions:
if len(self.extension) > 0 and self.extension not in expected_extensions:
self.log_details.update({'expected_extensions': expected_extensions})
self.make_dangerous()

View File

@ -85,7 +85,7 @@ class File(FileBase):
if aliases.get(mimetype) is not None:
mimetype = aliases.get(mimetype)
expected_extensions = mimetypes.guess_all_extensions(mimetype, strict=False)
if expected_extensions is not None:
if expected_extensions:
if len(self.extension) > 0 and self.extension not in expected_extensions:
self.log_details.update({'expected_extensions': expected_extensions})
self.make_dangerous()