On 3/6/21 2:55 PM, Mark Dale via Mailman-Users wrote:
> 
> If it turns out that the the owner is unable to modify their Perl script, 
> setting this shell script to run once a day may not be a problem as their 
> list is auto-posted to at a scheduled time every day. It's a kludge of a 
> "fix" I know, but it will limp it home.


The patch I posted previously was bad. This one is correct. If you patch
Scrubber.py with this patch, you won't need to edit the mbox and rebuild
the archive as that message won't get scrubbed.

-- 
Mark Sapiro <m...@msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan
=== modified file 'Mailman/Handlers/Scrubber.py'
--- Mailman/Handlers/Scrubber.py        2020-06-21 18:45:30 +0000
+++ Mailman/Handlers/Scrubber.py        2021-03-06 19:10:28 +0000
@@ -90,6 +90,9 @@
     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 @@
                 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)

------------------------------------------------------
Mailman-Users mailing list -- mailman-users@python.org
To unsubscribe send an email to mailman-users-le...@python.org
https://mail.python.org/mailman3/lists/mailman-users.python.org/
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: https://www.mail-archive.com/mailman-users@python.org/
    https://mail.python.org/archives/list/mailman-users@python.org/

Reply via email to