Patchwork [1,of,3,STABLE,v2] py3: decode payload of notify email

login
register
mail settings
Submitter Denis Laxalde
Date Oct. 25, 2019, 12:53 p.m.
Message ID <4ed5932bd9a54928a921.1572008033@steppe.local>
Download mbox | patch
Permalink /patch/42588/
State Accepted
Headers show

Comments

Denis Laxalde - Oct. 25, 2019, 12:53 p.m.
# HG changeset patch
# User Denis Laxalde <denis.laxalde@logilab.fr>
# Date 1571927683 -7200
#      Thu Oct 24 16:34:43 2019 +0200
# Branch stable
# Node ID 4ed5932bd9a54928a92156ac0252ce97965e6987
# Parent  416041f97cc333b9a1bf04d10b5502ac78a3f33d
py3: decode payload of notify email

This fixes one UnicodeEncodeError in test-notify.t:422 when testing the
notify hook with non-ascii content (there are more later). We only
decode on Python 3, since it's not safe for sure on Python 2.
Yuya Nishihara - Oct. 26, 2019, 1:31 a.m.
On Fri, 25 Oct 2019 14:53:53 +0200, Denis Laxalde wrote:
> # HG changeset patch
> # User Denis Laxalde <denis.laxalde@logilab.fr>
> # Date 1571927683 -7200
> #      Thu Oct 24 16:34:43 2019 +0200
> # Branch stable
> # Node ID 4ed5932bd9a54928a92156ac0252ce97965e6987
> # Parent  416041f97cc333b9a1bf04d10b5502ac78a3f33d
> py3: decode payload of notify email

Queued for stable, thanks.

Patch

diff --git a/hgext/notify.py b/hgext/notify.py
--- a/hgext/notify.py
+++ b/hgext/notify.py
@@ -400,7 +400,7 @@  class notifier(object):
             # create fresh mime message from scratch
             # (multipart templates must take care of this themselves)
             headers = msg.items()
-            payload = msg.get_payload()
+            payload = msg.get_payload(decode=pycompat.ispy3)
             # for notification prefer readability over data precision
             msg = mail.mimeencode(self.ui, payload, self.charsets, self.test)
             # reinstate custom headers