aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman
diff options
context:
space:
mode:
authorMark Sapiro <mark@msapiro.net>2015-01-30 12:04:52 -0800
committerMark Sapiro <mark@msapiro.net>2015-01-30 12:04:52 -0800
commit557cf86c3a3f66c80d80b33d1d8e04788e7d2038 (patch)
tree6be47dd64ef1b62f719138626806c90628b5fab4 /Mailman
parent91ac8e2e8559192969c6877a779d47283e39cb09 (diff)
downloadmailman2-557cf86c3a3f66c80d80b33d1d8e04788e7d2038.tar.gz
mailman2-557cf86c3a3f66c80d80b33d1d8e04788e7d2038.tar.xz
mailman2-557cf86c3a3f66c80d80b33d1d8e04788e7d2038.zip
The admindb interface has been fixed so the the detail message body
display doesn't lose part of a multi-byte character, and characters which are invalid in the message's charset are replaced rather than the whole body not being converted to the display charset.
Diffstat (limited to '')
-rw-r--r--Mailman/Cgi/admindb.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/Mailman/Cgi/admindb.py b/Mailman/Cgi/admindb.py
index 36d7a16f..d65720ab 100644
--- a/Mailman/Cgi/admindb.py
+++ b/Mailman/Cgi/admindb.py
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2014 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2015 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -671,13 +671,11 @@ def show_post_requests(mlist, id, info, total, count, form):
for line in email.Iterators.body_line_iterator(msg, decode=True):
lines.append(line)
chars += len(line)
- if chars > limit > 0:
+ if chars >= limit > 0:
break
- # Negative values mean display the entire message, regardless of size
- if limit > 0:
- body = EMPTYSTRING.join(lines)[:mm_cfg.ADMINDB_PAGE_TEXT_LIMIT]
- else:
- body = EMPTYSTRING.join(lines)
+ # We may have gone over the limit on the last line, but keep the full line
+ # anyway to avoid losing part of a multibyte character.
+ 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
@@ -692,7 +690,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, 'replace')
+ body = unicode(body, mcset, 'replace').encode(lcset, 'replace')
except (LookupError, UnicodeError, ValueError):
pass
hdrtxt = NL.join(['%s: %s' % (k, v) for k, v in msg.items()])