[PATCH 2 of 2 STABLE V3] py3: fix patchbomb to accept non-ASCII header value for email preview

Denis Laxalde denis at laxalde.org
Wed Oct 30 18:17:25 UTC 2019


Yuya Nishihara a écrit :
> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1572439788 -32400
> #      Wed Oct 30 21:49:48 2019 +0900
> # Branch stable
> # Node ID 3b53b4da70668d5abd27993778fe2da0606aca45
> # Parent  e7add06518eeebeb236a97ab051bb55e95c591b8
> py3: fix patchbomb to accept non-ASCII header value for email preview

Looks good to me, thanks!

> 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]



More information about the Mercurial-devel mailing list