aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman/Handlers
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Mailman/Handlers/Scrubber.py10
-rw-r--r--Mailman/Handlers/WrapMessage.py10
2 files changed, 16 insertions, 4 deletions
diff --git a/Mailman/Handlers/Scrubber.py b/Mailman/Handlers/Scrubber.py
index cecd11fb..a498f814 100644
--- a/Mailman/Handlers/Scrubber.py
+++ b/Mailman/Handlers/Scrubber.py
@@ -90,6 +90,9 @@ def guess_extension(ctype, ext):
if ctype.lower == 'application/octet-stream':
# For this type, all[0] is '.obj'. '.bin' is better.
return '.bin'
+ if ctype.lower == 'text/plain':
+ # For this type, all[0] is '.ksh'. '.txt' is better.
+ return '.txt'
return all and all[0]
@@ -196,8 +199,11 @@ def process(mlist, msg, msgdata=None):
format = part.get_param('format')
delsp = part.get_param('delsp')
# TK: if part is attached then check charset and scrub if none
- if part.get('content-disposition') and \
- not part.get_content_charset():
+ # MAS: Content-Disposition is not a good test for 'attached'.
+ # RFC 2183 sec. 2.10 allows Content-Disposition on the main body.
+ # Make it specifically 'attachment'.
+ if (part.get('content-disposition', '').lower() == 'attachment'
+ and not part.get_content_charset()):
omask = os.umask(002)
try:
url = save_attachment(mlist, part, dir)
diff --git a/Mailman/Handlers/WrapMessage.py b/Mailman/Handlers/WrapMessage.py
index 0ee08cb1..3aef64a2 100644
--- a/Mailman/Handlers/WrapMessage.py
+++ b/Mailman/Handlers/WrapMessage.py
@@ -63,13 +63,19 @@ def process(mlist, msg, msgdata):
# make a copy of the msg, then delete almost everything and set/copy
# what we want.
omsg = copy.deepcopy(msg)
+ # If CookHeaders didn't change the Subject: we need to keep it too.
+ # Get a fresh list.
+ keepers = list(KEEPERS)
+ if 'subject' not in [key.lower() for key in
+ msgdata.get('add_header', {}).keys()]:
+ keepers.append('subject')
for key in msg.keys():
- if key.lower() not in KEEPERS:
+ if key.lower() not in keepers:
del msg[key]
msg['MIME-Version'] = '1.0'
msg['Message-ID'] = Utils.unique_message_id(mlist)
# Add the headers from CookHeaders.
- for k, v in msgdata['add_header'].items():
+ for k, v in msgdata.get('add_header', {}).items():
msg[k] = v
# Are we including dmarc_wrapped_message_text? I.e., do we have text and
# are we wrapping because of dmarc_moderation_action?