Order import: Catch utf8 errors (PRETIXEU-9FP)

This commit is contained in:
Raphael Michel
2023-12-05 13:40:00 +01:00
parent d6d6b73a38
commit b95da484a0

View File

@@ -91,7 +91,15 @@ def import_orders(event: Event, fileid: str, settings: dict, locale: str, user,
user = User.objects.get(pk=user)
with language(locale, event.settings.region):
cols = get_all_columns(event)
parsed = parse_csv(cf.file, charset=charset)
try:
parsed = parse_csv(cf.file, charset=charset)
except UnicodeDecodeError as e:
raise DataImportError(
_(
'Error decoding special characters in your file: {message}').format(
message=str(e)
)
)
orders = []
order = None
data = []