rjbs / Email-MIME

perl library for parsing MIME messages
20 stars 30 forks source link

Long filenames are not supported #31

Closed dxdc closed 4 years ago

dxdc commented 7 years ago

Long filenames are allowed per RFC 2231.

For example:

Content-Disposition: attachment;
    filename*0="Blank App to Rent _ Application to Rent Screening Fee #1 - 4 03.";
    filename*1=pdf
Content-Type: application/pdf;
    name*0="Blank App to Rent _ Application to Rent Screening Fee #1 - 4 03.";
    name*1=pdf
Content-Transfer-Encoding: base64

However, these extended filenames are not properly returned via the Email::MIME module (or, appropriate submodule). These extended filenames can also become more complex, since character encoding, etc. can be specified as part of the filename. See RFC 2231 for more details (https://tools.ietf.org/html/rfc2231).

There is another module which appears to handle this properly: http://cpansearch.perl.org/src/MURATAYA/MIME-EcoEncode-0.95/lib/MIME/EcoEncode/Param.pm

pali commented 7 years ago

This pull request https://github.com/rjbs/Email-MIME-ContentType/pull/5 adds support for RFC 2231 (Character Set and Parameter Continuations). Email::MIME::ContentType is used just for parsing structures.

pali commented 7 years ago

Pull request https://github.com/rjbs/Email-MIME-ContentType/pull/5 was merged and released in Email::MIME::ContentType version 1.020.

So after updating that module, Email::MIME would correctly parse long file names.

But creating new email with long file names via Email::MIME is not supported yet.

pali commented 7 years ago

Patches for creating long file names are there: https://github.com/rjbs/Email-MIME-ContentType/pull/11 https://github.com/rjbs/Email-MIME/pull/51