From 40c37149fa132a872e1d62cf91b7efee7325a079 Mon Sep 17 00:00:00 2001 From: msapiro <> Date: Sun, 27 Nov 2005 22:37:18 +0000 Subject: Fix bug 1367783 - decode base64 and quoted-printable HTML parts when passing to mm_cfg.HTML_TO_PLAIN_TEXT_COMMAND --- Mailman/Handlers/MimeDel.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Mailman/Handlers/MimeDel.py b/Mailman/Handlers/MimeDel.py index 33cfe142..2d5caa64 100644 --- a/Mailman/Handlers/MimeDel.py +++ b/Mailman/Handlers/MimeDel.py @@ -197,7 +197,7 @@ def to_plaintext(msg): filename = tempfile.mktemp('.html') fp = open(filename, 'w') try: - fp.write(subpart.get_payload()) + fp.write(subpart.get_payload(decode=1)) fp.close() cmd = os.popen(mm_cfg.HTML_TO_PLAIN_TEXT_COMMAND % {'filename': filename}) @@ -213,6 +213,11 @@ def to_plaintext(msg): # Now replace the payload of the subpart and twiddle the Content-Type: subpart.set_payload(plaintext) subpart.set_type('text/plain') + try: + # not base64 or quoted-printable any more + subpart.replace_header('content-transfer-encoding', '8bit') + except KeyError: + pass changedp = 1 return changedp -- cgit v1.2.3