From 3c1fe7bcb3c10650cd039c800aa1356886586873 Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Sat, 31 Dec 2011 14:22:39 -0800 Subject: Fix for bug #629738 could cause a crash in the admindb details display if the decoded message body contained characters not in the character set of the list's preferred language. Fixed. Bug #910440. --- Mailman/Cgi/admindb.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Mailman/Cgi/admindb.py') diff --git a/Mailman/Cgi/admindb.py b/Mailman/Cgi/admindb.py index 639f64cc..d1873321 100644 --- a/Mailman/Cgi/admindb.py +++ b/Mailman/Cgi/admindb.py @@ -632,6 +632,8 @@ def show_post_requests(mlist, id, info, total, count, form): body = EMPTYSTRING.join(lines) # Get message charset and try encode in list charset # We get it from the first text part. + # We need to replace invalid characters here or we can throw an uncaught + # exception in doc.Format(). for part in msg.walk(): if part.get_content_maintype() == 'text': # Watchout for charset= with no value. @@ -642,7 +644,7 @@ def show_post_requests(mlist, id, info, total, count, form): lcset = Utils.GetCharSet(mlist.preferred_language) if mcset <> lcset: try: - body = unicode(body, mcset).encode(lcset) + body = unicode(body, mcset).encode(lcset, 'replace') except (LookupError, UnicodeError, ValueError): pass hdrtxt = NL.join(['%s: %s' % (k, v) for k, v in msg.items()]) -- cgit v1.2.3