summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormsapiro2005-11-27 22:37:55 +0000
committermsapiro2005-11-27 22:37:55 +0000
commit98ca03ed785ca20d48bedfa001e92d117bfc0335 (patch)
treea2e77ae8b685b0d001505705850801c936f0f671
parent5fd4f6690df4ed3103b41a8c73786335c85936bd (diff)
downloadmailman-98ca03ed785ca20d48bedfa001e92d117bfc0335.tar.gz
mailman-98ca03ed785ca20d48bedfa001e92d117bfc0335.tar.zst
mailman-98ca03ed785ca20d48bedfa001e92d117bfc0335.zip
Fix bug 1367783 - decode base64 and quoted-printable HTML parts when passing to mm_cfg.HTML_TO_PLAIN_TEXT_COMMAND
-rw-r--r--Mailman/Handlers/MimeDel.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Mailman/Handlers/MimeDel.py b/Mailman/Handlers/MimeDel.py
index 33cfe1420..2d5caa64d 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