Prevent crash when uploaded file has no content-type property
This commit is contained in:
parent
5bb96189ec
commit
4ca8f95326
1 changed files with 4 additions and 1 deletions
|
|
@ -295,7 +295,10 @@ class ImportViewBase(FormView):
|
|||
except Exception as e:
|
||||
if settings.DEBUG:
|
||||
raise
|
||||
messages.error(self.request, "L'importation a échoué. Erreur: %s (content-type: %s)" % (e, upfile.content_type))
|
||||
msg = "L'importation a échoué. Erreur: %s" % e
|
||||
if hasattr(upfile, 'content_type'):
|
||||
msg += " (content-type: %s)" % upfile.content_type
|
||||
messages.error(self.request, msg)
|
||||
else:
|
||||
non_fatal_errors = stats.get('errors', [])
|
||||
if 'created' in stats:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue