forked from mirrors/bookwyrm
Catch unexpectedly missing columns in csv imports
I kept the 500 error here so that things don't silently fail in unexepcted ways
This commit is contained in:
parent
b7ea3e5e6c
commit
62dc8270b6
1 changed files with 3 additions and 2 deletions
|
@ -7,6 +7,7 @@ from django.http import HttpResponseBadRequest
|
|||
from django.shortcuts import get_object_or_404, redirect
|
||||
from django.template.response import TemplateResponse
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views import View
|
||||
|
||||
from bookwyrm import forms, models
|
||||
|
@ -62,8 +63,8 @@ class Import(View):
|
|||
include_reviews,
|
||||
privacy,
|
||||
)
|
||||
except (UnicodeDecodeError, ValueError):
|
||||
return HttpResponseBadRequest("Not a valid csv file")
|
||||
except (UnicodeDecodeError, ValueError, KeyError):
|
||||
return HttpResponseBadRequest(_("Not a valid csv file"))
|
||||
|
||||
importer.start_import(job)
|
||||
|
||||
|
|
Loading…
Reference in a new issue