aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman/Handlers/Scrubber.py
diff options
context:
space:
mode:
authorYasuhito FUTATSUKI at POEM <futatuki@poem.co.jp>2021-10-15 05:39:36 +0900
committerYasuhito FUTATSUKI at POEM <futatuki@poem.co.jp>2021-10-15 05:39:36 +0900
commitd4a18da3a7dda34718f7043409f2dbc28a6e97c4 (patch)
tree0b6ce2aa91377c21584f836e650609d427e57ed6 /Mailman/Handlers/Scrubber.py
parent393892351c22b83e54b95965d17ae346e5fad989 (diff)
parent6cc831d90d9e22091c05f49e54502d188f7f0712 (diff)
downloadmailman2-d4a18da3a7dda34718f7043409f2dbc28a6e97c4.tar.gz
mailman2-d4a18da3a7dda34718f7043409f2dbc28a6e97c4.tar.xz
mailman2-d4a18da3a7dda34718f7043409f2dbc28a6e97c4.zip
sync merge lp:mailman/2.1 up to 1871
Diffstat (limited to 'Mailman/Handlers/Scrubber.py')
-rw-r--r--Mailman/Handlers/Scrubber.py10
1 files changed, 8 insertions, 2 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)