# HG changeset patch # User Yuya Nishihara # Date 2019-10-30 12:49:48 # Node ID 1a0d419ec763876f4ec131153cf2bb3c76beffb0 # Parent 08189f3acbc6865b8a2cc7a6c974668d7acdcf61 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. diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py --- a/hgext/patchbomb.py +++ b/hgext/patchbomb.py @@ -960,7 +960,10 @@ def email(ui, repo, *revs, **opts): 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]