From 10034526a11de85dcd631983ae8c6761d5fb2112 Mon Sep 17 00:00:00 2001 From: hoellen Date: Sun, 28 Jul 2019 08:29:17 +0200 Subject: [PATCH] Error handling for idna encoding --- core/admin/mailu/models.py | 5 ++++- towncrier/newsfragments/1087.bugfix | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 towncrier/newsfragments/1087.bugfix diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py index 95dc16a6..8176e461 100644 --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -27,7 +27,10 @@ class IdnaDomain(db.TypeDecorator): impl = db.String(80) def process_bind_param(self, value, dialect): - return idna.encode(value).decode("ascii").lower() + try: + return idna.encode(value).decode("ascii").lower() + except ValueError: + pass def process_result_value(self, value, dialect): return idna.decode(value) diff --git a/towncrier/newsfragments/1087.bugfix b/towncrier/newsfragments/1087.bugfix new file mode 100644 index 00000000..7d0ef69b --- /dev/null +++ b/towncrier/newsfragments/1087.bugfix @@ -0,0 +1 @@ +Error handling in idna encoding