[Reportbug-commits] [reportbug] 04/04: decode email addresses when printing the recipients recap at submit time; Closes: #546914

Sandro Tosi morph at moszumanska.debian.org
Thu Dec 31 02:48:15 UTC 2015


This is an automated email from the git hooks/post-receive script.

morph pushed a commit to branch master
in repository reportbug.

commit 47637003ed499cb0e4ccf5e36d88bac8ea102032
Author: Sandro Tosi <morph at debian.org>
Date:   Thu Dec 31 02:44:21 2015 +0000

    decode email addresses when printing the recipients recap at submit time; Closes: #546914
---
 debian/changelog    |  4 +++-
 reportbug/submit.py | 12 +++++++++---
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 46b3ee8..280ea3e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -16,8 +16,10 @@ reportbug (6.6.6) UNRELEASED; urgency=medium
     - in paranoid mode, handle the case when the pager exists without having
       processed all the text we are sending and it generates a SIGPIPE;
       Closes: #777010, #686922
+    - decode email addresses when printing the recipients recap at submit time;
+      Closes: #546914
 
- -- Sandro Tosi <morph at debian.org>  Thu, 31 Dec 2015 01:37:17 +0000
+ -- Sandro Tosi <morph at debian.org>  Thu, 31 Dec 2015 02:43:44 +0000
 
 reportbug (6.6.5) unstable; urgency=medium
 
diff --git a/reportbug/submit.py b/reportbug/submit.py
index bdb18bf..51fd0bb 100644
--- a/reportbug/submit.py
+++ b/reportbug/submit.py
@@ -34,7 +34,7 @@ from email.MIMEAudio import MIMEAudio
 from email.MIMEImage import MIMEImage
 from email.MIMEBase import MIMEBase
 from email.MIMEMessage import MIMEMessage
-from email.Header import Header
+from email.Header import Header, decode_header
 import mimetypes
 
 from __init__ import VERSION, VERSION_NUMBER
@@ -96,6 +96,12 @@ def rfc2047_encode_header(header, charset, mua=None):
     return encode_if_needed(header, charset)
 
 
+def decode_email_header(header):
+    # returns a list of 2-items tuples
+    decoded = decode_header(header)
+    return ' '.join([x[0] for x in decoded]).strip()
+
+
 # Cheat for now.
 # ewrite() may put stuff on the status bar or in message boxes depending on UI
 def ewrite(*args):
@@ -495,12 +501,12 @@ def send_report(body, attachments, mua, fromaddr, sendto, ccaddr, bccaddr,
         if len(addresses):
             ewrite("Copies sent to:\n")
             for address in addrs:
-                ewrite('  %s\n', address)
+                ewrite('  %s\n', decode_email_header(address))
 
         if debbugs_cc and rtype == 'debbugs':
             ewrite("Copies will be sent after processing to:\n")
             for address in cclist:
-                ewrite('  %s\n', address)
+                ewrite('  %s\n', decode_email_header(address))
 
     if not (exinfo or kudos) and rtype == 'debbugs' and sysinfo and not failed \
             and mailing:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reportbug/reportbug.git



More information about the Reportbug-commits mailing list