Re: bug in content-disposition parsing

Mark Overmeer <[email protected]> Tue, 27 Jul 2004 23:40:46 +0200
Newsgroups gmane.comp.lang.perl.modules.mail-box
Organization MARKOV Solutions
Message-ID <[email protected]>
* Todd Richmond ([email protected]) [040727 22:09]:
> There is bug when Mail::Box attempts to parse Content-Disposition attributes
> when vales are not quoted. Calling
> $part->body->disposition->attribute('filename') on a message part with the
> header:
> 
> Content-Disposition: attachment; filename=Cat.scr; modification-date="Mon,
> 19 Jul 2004 16:45:17 -0500"
> 
> returns "Cat.scr;" with an extra ';' attached. If the space after the ; is
> removed, the file becomes "Cat.scr;modification-date=Mon,"

Mail::Message::Field::attribute() does this:

           $body =~ m/\b$attr\s*\=\s*
                       ( "( (?: [^"]|\\" )* )"
                       | '( (?: [^']|\\' )* )'
                       | (\S*)
                       )
                  /xi ? $+ : undef;

But (\S*)  should be replaced by  ([^;\s]*)   I presume.

There are two more places where changes are needed.  I'll release a 
new version of MailBox at the end of this week: I have a whole shipload
of fixes and extensions ready....
-- 
Thanks for the report,

               MarkOv

------------------------------------------------------------------------
drs Mark A.C.J. Overmeer                                MARKOV Solutions
       [email protected]                          [email protected]
http://Mark.Overmeer.net                   http://solutions.overmeer.net