A text/plain message body is scrubbed with a .ksh extension

Bug #1917968 reported by Mark Sapiro
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Mailman
Fix Released
Low
Mark Sapiro

Bug Description

If a simple text/plain message has a Content-Disposition: header and does not have a Content-Type: header with a charset parameter, the body will be scrubbed to a file with a .ksh extension.

It is only text/plain attachments that should be scrubbed in this way and they should be given a .txt extension.

Related branches

Revision history for this message
Jim Popovitch (jimpop) wrote :

Some msgs won't have a Content-Disposition header.

Mar 06 13:46:43 2021 (6223) uncaught archiver exception at filepos: 0
Mar 06 13:46:43 2021 (6223) Uncaught runner exception: 'NoneType' object has no attribute 'lower'
Mar 06 13:46:43 2021 (6223) Traceback (most recent call last):
  File "/var/lib/mailman/Mailman/Queue/Runner.py", line 119, in _oneloop
    self._onefile(msg, msgdata)
  File "/var/lib/mailman/Mailman/Queue/Runner.py", line 190, in _onefile
    keepqueued = self._dispose(mlist, msg, msgdata)
  File "/var/lib/mailman/Mailman/Queue/ArchRunner.py", line 77, in _dispose
    mlist.ArchiveMail(msg)
  File "/var/lib/mailman/Mailman/Archiver/Archiver.py", line 250, in ArchiveMail
    h.processUnixMailbox(f)
  File "/var/lib/mailman/Mailman/Archiver/pipermail.py", line 584, in processUnixMailbox
    m = mbox.next()
  File "/usr/lib/python2.7/mailbox.py", line 2076, in next
    return self.factory(_PartialFile(self.fp, start, stop))
  File "/var/lib/mailman/Mailman/Mailbox.py", line 90, in scrubber
    return mailbox.scrub(msg)
  File "/var/lib/mailman/Mailman/Mailbox.py", line 110, in scrub
    return self._scrubber(self._mlist, msg)
  File "/var/lib/mailman/Mailman/Handlers/Scrubber.py", line 205, in process
    if part.get('content-disposition').lower() == 'attachment' and \
AttributeError: 'NoneType' object has no attribute 'lower'

Revision history for this message
Jim Popovitch (jimpop) wrote :

Try changing it to

if part.get('content-disposition') and part.get('content-disposition').lower() == 'attachment'...

It's ugly, but it works! :)

Revision history for this message
Mark Sapiro (msapiro) wrote :

Thanks for pointing that out.

Revision history for this message
Mark Sapiro (msapiro) wrote :

Actually

part.get('content-disposition', '').lower() == 'attachment'...

is the fix.

Revision history for this message
Jim Popovitch (jimpop) wrote :

Nice! Thanks.

Mark Sapiro (msapiro)
Changed in mailman:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.