changeset 43339:1a0d419ec763 stable

py3: fix patchbomb to accept non-ASCII header value for email preview Since mail.headencode() is disabled by -n/--test, non-ASCII header value has to be allowed. Spotted by Denis Laxalde.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 30 Oct 2019 21:49:48 +0900
parents 08189f3acbc6
children e0812b032bcc
files hgext/patchbomb.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/patchbomb.py	Fri Oct 25 12:10:45 2019 +0200
+++ b/hgext/patchbomb.py	Wed Oct 30 21:49:48 2019 +0900
@@ -960,7 +960,10 @@
                     hdr = pycompat.strurl(hdr)
                     change = True
                 if isinstance(val, bytes):
-                    val = pycompat.strurl(val)
+                    # header value should be ASCII since it's encoded by
+                    # mail.headencode(), but -n/--test disables it and raw
+                    # value of platform encoding is stored.
+                    val = encoding.strfromlocal(val)
                     if not change:
                         # prevent duplicate headers
                         del m[hdr]