aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman/Handlers/Scrubber.py
diff options
context:
space:
mode:
authorTokio Kikuchi <tkikuchi@is.kochi-u.ac.jp>2007-11-16 11:48:35 +0900
committerTokio Kikuchi <tkikuchi@is.kochi-u.ac.jp>2007-11-16 11:48:35 +0900
commit8f5d8d2eb9e8bf62a598f126419d18eb3163050e (patch)
treee9dd5c5e73bed1b75811ff7614ba6489c2cd48f1 /Mailman/Handlers/Scrubber.py
parentba98caf52c18dea4ea244c092617677bdbb01015 (diff)
parent70689d7eb61f8c852a6a02be1d65c86cde06bde2 (diff)
downloadmailman2-8f5d8d2eb9e8bf62a598f126419d18eb3163050e.tar.gz
mailman2-8f5d8d2eb9e8bf62a598f126419d18eb3163050e.tar.xz
mailman2-8f5d8d2eb9e8bf62a598f126419d18eb3163050e.zip
merge and commit
Diffstat (limited to '')
-rw-r--r--Mailman/Handlers/Scrubber.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/Mailman/Handlers/Scrubber.py b/Mailman/Handlers/Scrubber.py
index 48660038..588dd9ac 100644
--- a/Mailman/Handlers/Scrubber.py
+++ b/Mailman/Handlers/Scrubber.py
@@ -45,7 +45,7 @@ from Mailman.Logging.Syslog import syslog
# Path characters for common platforms
pre = re.compile(r'[/\\:]')
# All other characters to strip out of Content-Disposition: filenames
-# (essentially anything that isn't an alphanum, dot, slash, or underscore.
+# (essentially anything that isn't an alphanum, dot, dash, or underscore).
sre = re.compile(r'[^-\w.]')
# Regexp to strip out leading dots
dre = re.compile(r'^\.*')
@@ -298,7 +298,7 @@ URL: %(url)s
# If the message isn't a multipart, then we'll strip it out as an
# attachment that would have to be separately downloaded. Pipermail
# will transform the url into a hyperlink.
- elif part and not part.is_multipart():
+ elif part._payload and not part.is_multipart():
payload = part.get_payload(decode=True)
ctype = part.get_type()
# XXX Under email 2.5, it is possible that payload will be None.
@@ -349,7 +349,8 @@ URL: %(url)s
text = []
for part in msg.walk():
# TK: bug-id 1099138 and multipart
- if not part or part.is_multipart():
+ # MAS test payload - if part may fail if there are no headers.
+ if not part._payload or part.is_multipart():
continue
# All parts should be scrubbed to text/plain by now.
partctype = part.get_content_type()
@@ -447,8 +448,6 @@ def save_attachment(mlist, msg, dir, filter_html=True):
ext = fnext or guess_extension(ctype, fnext)
else:
ext = guess_extension(ctype, fnext)
- # Allow only alphanumerics, dash, underscore, and dot
- ext = sre.sub('', ext)
if not ext:
# We don't know what it is, so assume it's just a shapeless
# application/octet-stream, unless the Content-Type: is
@@ -458,6 +457,8 @@ def save_attachment(mlist, msg, dir, filter_html=True):
ext = '.txt'
else:
ext = '.bin'
+ # Allow only alphanumerics, dash, underscore, and dot
+ ext = sre.sub('', ext)
path = None
# We need a lock to calculate the next attachment number
lockfile = os.path.join(fsdir, 'attachments.lock')