[Mailman-Developers] [ mailman-Bugs-598844 ] BASE64 attachments barfing

SourceForge.net noreply at sourceforge.net
Fri Jan 17 02:29:30 EST 2003

Bugs item #598844, was opened at 2002-08-22 15:52
You can respond by visiting: 

Category: Pipermail
Group: 2.1 beta
Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: Patrick Finnerty (finnertyp)
Assigned to: Nobody/Anonymous (nobody)
Summary: BASE64 attachments barfing

Initial Comment:
When testing MIME attachments I get the following error
which occurs using arch to convert a mailbox or when
posting to the archive:

Pickling archive state into
Traceback (most recent call last):
  File "bin/arch", line 160, in ?
  File "bin/arch", line 148, in main
    archiver.processUnixMailbox(fp, Article, start,
line 545, in processUnixMailbox
    m = mbox.next()
  File "/usr/local/lib/python2.2/mailbox.py", line 34,
in next
    return self.factory(_Subfile(self.fp, start, stop))
  File "/usr/local/mailman/Mailman/Mailbox.py", line
69, in scrubber
    return mailbox.scrub(msg)
  File "/usr/local/mailman/Mailman/Mailbox.py", line
89, in scrub
    return self._scrubber(self._mlist, msg)
"/usr/local/mailman/Mailman/Handlers/Scrubber.py", line
114, in process
    url = save_attachment(mlist, part, filter_html=0)
"/usr/local/mailman/Mailman/Handlers/Scrubber.py", line
217, in save_attachment
    decodedpayload = msg.get_payload(decode=1)
  File "/usr/local/mailman/pythonlib/email/Message.py",
line 177, in get_payload
    return Utils._bdecode(payload)
  File "/usr/local/mailman/pythonlib/email/Utils.py",
line 71, in _bdecode
    value = base64.decodestring(s)
  File "/usr/local/lib/python2.2/base64.py", line 44,
in decodestring
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding

I've narrowed this down to HTML attachments that
include tables. I've attached a mbox that will give
this error when used with arch. This only happens when
base64 is used.

I've also found that even when messages with HTML
attachments are archived, clicking on the attachment
doesn't display the page but the source instead. Or in
some cases it can be garbage. I can supply more info on
this if you wish.


Comment By: Samuel Nicolary (nicolary)
Date: 2003-01-17 10:29

Logged In: YES 

When I monitored what strings were causing this to barf I 
found that there were two scenarios - one when the mailman 
generated html descibing the file was being sent to this 
function (I have no idea why it is doing this)
Ex. A non-text attachment was scrubbed...

The second scenario that was truly a padding issue I got 
around by doing the following in the _bdecode funtion:
value = base64.decodestring(s+'=========')

let me know if you want a full patch of my trashy hack.


Comment By: Barry A. Warsaw (bwarsaw)
Date: 2002-08-22 19:09

Logged In: YES 

Thanks for the report and the mbox file, this was indeed a
bug, which will be fixed in beta4.

As for you second question, what you're seeing could be
caused by this bug, but it's more likely just the behavior
specified by ARCHIVE_HTML_SANTIZER in Defaults.py/mm_cfg.py.
 To prohibit evil stuff like cross-site scripting, or web
bugs and virus from affecting your archive readers, html is
typically santized to be harmless.


Comment By: Patrick Finnerty (finnertyp)
Date: 2002-08-22 15:58

Logged In: YES 

Whoops. Attached the html file which was used as attachment
instead of the mbox file....
...which I'm gonna upload now.


You can respond by visiting: 

More information about the Mailman-Developers mailing list