From 9bdb4029f331ea6230c668e408c2f694491ec6e4 Mon Sep 17 00:00:00 2001 From: tkikuchi <> Date: Thu, 14 Oct 2004 08:05:06 +0000 Subject: fix bugs when using ARCHIVE_HTML_SANITIZER = 1 --- Mailman/Archiver/pipermail.py | 3 ++- Mailman/Handlers/Scrubber.py | 5 +++-- Mailman/Handlers/ToDigest.py | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Mailman/Archiver/pipermail.py b/Mailman/Archiver/pipermail.py index ec8e46f6..44dce52c 100644 --- a/Mailman/Archiver/pipermail.py +++ b/Mailman/Archiver/pipermail.py @@ -217,7 +217,8 @@ class Article: self.headers[i] = message[i] # Read the message body - s = StringIO(message.get_payload()) + s = StringIO(message.get_payload(decode=1)\ + or message.as_string().split('\n\n',1)[1]) self.body = s.readlines() def _set_date(self, message): diff --git a/Mailman/Handlers/Scrubber.py b/Mailman/Handlers/Scrubber.py index 7429c0b4..6116806b 100644 --- a/Mailman/Handlers/Scrubber.py +++ b/Mailman/Handlers/Scrubber.py @@ -309,7 +309,7 @@ Url : %(url)s # We still have to sanitize multipart messages to flat text because # Pipermail can't handle messages with list payloads. This is a kludge; # def (n) clever hack ;). - if msg.is_multipart(): + if msg.is_multipart() and sanitize <> 2: # By default we take the charset of the first text/plain part in the # message, but if there was none, we'll use the list's preferred # language's charset. @@ -402,7 +402,8 @@ def save_attachment(mlist, msg, dir, filter_html=True): # For safety, we should confirm this is valid ext for content-type # but we can use fnext if we introduce fnext filtering if mm_cfg.SCRUBBER_USE_ATTACHMENT_FILENAME_EXTENSION: - ext = fnext + # HTML message doesn't have filename :-( + ext = fnext or guess_extension(ctype, fnext) else: ext = guess_extension(ctype, fnext) if not ext: diff --git a/Mailman/Handlers/ToDigest.py b/Mailman/Handlers/ToDigest.py index f350768e..2f64b369 100644 --- a/Mailman/Handlers/ToDigest.py +++ b/Mailman/Handlers/ToDigest.py @@ -314,7 +314,8 @@ def send_i18n_digests(mlist, mboxfp): uh = '\n\t'.join(uh.split('\n')) print >> plainmsg, uh print >> plainmsg - payload = msg.get_payload(decode=True) + payload = msg.get_payload(decode=True)\ + or msg.as_string().split('\n\n',1)[1] print >> plainmsg, payload if not payload.endswith('\n'): print >> plainmsg -- cgit v1.2.3