From 30e7e6f98bb51b91973f847ba2f752ae80c79803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 31 Oct 2018 09:26:44 +0100 Subject: [PATCH] misc: don't crash on uploaded files with an unknonw mime type (#27695) --- wcs/qommon/form.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wcs/qommon/form.py b/wcs/qommon/form.py index 8e81fd2ae..b1fbf83ae 100644 --- a/wcs/qommon/form.py +++ b/wcs/qommon/form.py @@ -701,6 +701,9 @@ class FileWithPreviewWidget(CompositeWidget): return False filetype = (mimetypes.guess_type(temp.get('orig_filename', '')) or [''])[0] + if not filetype: + return False + if filetype == 'application/pdf': return HAS_GM -- 2.19.1