Subject: | patch for RFC 2183 Content-Disposition handling |
Hi Simon,
I have a patch for Email::MIME 1.3 that silences a warning in Email::MIME::ContentType::_parse_attributes() against an
inline Content-Disposition field of this form:
Content-type: multipart/signed; micalg=pgp-sha1;
protocol="application/pgp-signature"; boundary=ZmUaFz6apKcXQszQ
Content-disposition: inline
or even this:
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
To duplicate, simply
my $parsed = Email::MIME->new($message);
where $message contains one of the above content-disposition headers
(e.g., the mutt mail agent creates these kinds of headers for the
main text body after attaching a file).
That $dis is parsed (in attached patch) via _parse_attributes for ContentType is probably not correct, since Content-Type and Content-Disposition headers have different syntaxes. The other case
similar to 'inline' is 'attachment', which (like 'inline') doesn't
require any parameters but they are nearly always supplied (RFC 2183
part 2).
Either way it doesn't seem to affect the parsing of the object (I did
a Dumper on a Email::MIME object both ways and they came out
equivalent).
Btw, your Email::MIME package has saved me at least a week on my
current project; thanks a TON.
Scott
--- MIME.pm~ Mon Apr 5 16:24:55 2004
+++ MIME.pm Thu Jul 1 02:50:16 2004
@@ -108,7 +108,7 @@
return $gcache{$self} if exists $gcache{$self};
my $dis = $self->header("Content-Disposition");
- $dis =~ s/^.*?;//;
+ $dis =~ s/^(?:.*?;|inline|attachment)//i;
my $attrs = Email::MIME::ContentType::_parse_attributes($dis);
my $name = $attrs->{filename}
|| $self->{ct}{attributes}{name};