misc: don't crash on uploaded files with an unknown mime type (#27695)

This commit is contained in:
Frédéric Péters 2018-10-31 09:26:44 +01:00
parent 5d1e59d7b6
commit 59886501f8
1 changed files with 3 additions and 0 deletions

View File

@ -699,6 +699,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