Patchwork [09,of,10,STABLE] py3: decode email headers with mail.headdecode() in notify extension

login
register
mail settings
Submitter Denis Laxalde
Date Oct. 24, 2019, 3:30 p.m.
Message ID <b3070247092e461d15f0.1571931040@steppe.local>
Download mbox | patch
Permalink /patch/42565/
State Accepted
Headers show

Comments

Denis Laxalde - Oct. 24, 2019, 3:30 p.m.
# HG changeset patch
# User Denis Laxalde <denis.laxalde@logilab.fr>
# Date 1571925015 -7200
#      Thu Oct 24 15:50:15 2019 +0200
# Branch stable
# Node ID b3070247092e461d15f0921618b94a2b1646fdf1
# Parent  ea82b3a69f6ae2e83ecf905c4f9123a778d12f5e
py3: decode email headers with mail.headdecode() in notify extension

Patch

diff --git a/hgext/notify.py b/hgext/notify.py
--- a/hgext/notify.py
+++ b/hgext/notify.py
@@ -391,9 +391,9 @@  class notifier(object):
         sender = msg[r'From']
         subject = msg[r'Subject']
         if sender is not None:
-            sender = encoding.strtolocal(sender)
+            sender = mail.headdecode(sender)
         if subject is not None:
-            subject = encoding.strtolocal(subject)
+            subject = mail.headdecode(subject)
         del msg[r'From'], msg[r'Subject']
 
         if not msg.is_multipart():