[Mailman-Users] Attachments - PDF Issue

John DeCarlo jdecarlo at mitre.org
Wed Nov 5 18:13:26 CET 2003


Again, changing Scrubber.py will affect all the lists on that server.

Warning aside, I took a look at Scrubber.py.

Look at the function save_attachment().

The line 'ext = guess_extension(ctype, fnext)' tries to guess the proper 
file extension based on the extension of the file name in the message 
(fnext) and the MIME content type (ctype).  The content type is the 
primary determinant.  If guess_extension() doesn't give an answer, the 
if clause just beneath it takes over.

You have several options available, as with any programming change.

1.  Just give every file the extension it had in the message.  To do 
that, change the else: line to:

ext = fnext

2.  Just worry about the .pdf files.  To do that, in front of the else: 
line type in:

elif fnext == '.pdf':
    ext = '.pdf'

(Now I am not 100 percent sure this will work, not being a Python 
programmer, so take it with a grain of salt.)

McKeever Chris wrote:

> I understand that it is questionable, but there isnt _anything_ I can do on the MUA side, and seeing that it isnt a public list/archive
> that really only gets .pdf files (sent via a fax server) I dont think it is all that dangerous.
> I need to figure out how to have the code rely on the extension over the content type.  If anyone has knowledge of modifying the 
> Scrubber.py (I think that is where it is) to allow this, please let me know


John DeCarlo, My Views Are My Own

More information about the Mailman-Users mailing list