diff options
author | tkikuchi <> | 2004-10-03 06:00:32 +0000 |
---|---|---|
committer | tkikuchi <> | 2004-10-03 06:00:32 +0000 |
commit | 3b90e75081f508f9fcdf1764f83e6a416216e079 (patch) | |
tree | 6834a8a99f6e09ca1fd4499eacc81963163b8268 /Mailman/Handlers/Scrubber.py | |
parent | 56e41649e44be99ee7c6ac5a0421adad3d67df12 (diff) | |
download | mailman2-3b90e75081f508f9fcdf1764f83e6a416216e079.tar.gz mailman2-3b90e75081f508f9fcdf1764f83e6a416216e079.tar.xz mailman2-3b90e75081f508f9fcdf1764f83e6a416216e079.zip |
Merging SF patches:
[ 904850 ] Scrubber in regular delivery per list
[ 1027882 ] filter attachments by filename extensions
and a patch in mailman-dev mailing list
http://mail.python.org/pipermail/mailman-developers/2004-September/017246.html
Diffstat (limited to 'Mailman/Handlers/Scrubber.py')
-rw-r--r-- | Mailman/Handlers/Scrubber.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/Mailman/Handlers/Scrubber.py b/Mailman/Handlers/Scrubber.py index 8c1124ec..7429c0b4 100644 --- a/Mailman/Handlers/Scrubber.py +++ b/Mailman/Handlers/Scrubber.py @@ -168,6 +168,12 @@ def process(mlist, msg, msgdata=None): outer = True if msgdata is None: msgdata = {} + if msgdata: + # msgdata is available if it is in GLOBAL_PIPELINE + # ie. not in digest or archiver + # check if the list owner want to scrub regular delivery + if not mlist.scrub_nondigest: + return dir = calculate_attachments_dir(mlist, msg, msgdata) charset = None lcset = Utils.GetCharSet(mlist.preferred_language) @@ -389,8 +395,16 @@ def save_attachment(mlist, msg, dir, filter_html=True): # e.g. image/jpg (should be image/jpeg). For now we just store such # things as application/octet-streams since that seems the safest. ctype = msg.get_content_type() - fnext = os.path.splitext(msg.get_filename(''))[1] - ext = guess_extension(ctype, fnext) + # i18n file name is encoded + lcset = Utils.GetCharSet(mlist.preferred_language) + filename = Utils.oneline(msg.get_filename(''), lcset) + fnext = os.path.splitext(filename)[1] + # For safety, we should confirm this is valid ext for content-type + # but we can use fnext if we introduce fnext filtering + if mm_cfg.SCRUBBER_USE_ATTACHMENT_FILENAME_EXTENSION: + ext = fnext + else: + ext = guess_extension(ctype, fnext) 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 |