From: Daniel Axtens Date: Wed, 28 Jun 2017 07:48:45 +0000 (+1000) Subject: parser: codec lookup fails when a NUL (\x00) is in the name X-Git-Tag: v2.0.0~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75c2cff7ba29fa7bc92428ade415e26dd4694696;p=thirdparty%2Fpatchwork.git parser: codec lookup fails when a NUL (\x00) is in the name On Python3 this presents as a ValueError On Python2 this presents as a TypeError In both cases, catch these exceptions. Signed-off-by: Daniel Axtens Reviewed-by: Stephen Finucane --- diff --git a/patchwork/parser.py b/patchwork/parser.py index f9934cc1..534e92c7 100644 --- a/patchwork/parser.py +++ b/patchwork/parser.py @@ -436,7 +436,7 @@ def _find_content(mail): if charset is not None: try: codecs.lookup(charset) - except LookupError: + except (LookupError, ValueError, TypeError): charset = None # If there is no charset or if it is unknown, then try some common