Laurielounge has asked for the wisdom of the Perl Monks concerning the following question:
Hi gang,
CENTOS 7, perl 5.
I'm having problems with MIME::Parser extracting (correctly) attachments but incorrectly naming them. An attachment defined as :
I'm having problems with MIME::Parser extracting (correctly) attachments but incorrectly naming them. An attachment defined as :
... and code defined as...Content-Type: application/vnd.openxmlformats-officedocument.spreadshee +tml.sheet; name="Copy of 1501733944381-20170803 Dataload.xlsx" Content-Description: Copy of 1501733944381-20170803 Dataload.xlsx Content-Disposition: attachment; filename="Copy of 1501733944381-20170803 Dataload.xlsx"; size=23847; creation-date="Mon, 09 Oct 2017 12:39:28 GMT"; modification-date="Mon, 09 Oct 2017 12:38:40 GMT" Content-Transfer-Encoding: base64
... and variable $email defined as a full path and filename, I get a file created in /tmp/$emailfilename asmy $emailfile = basename("$email"); my $tmpdir = "/tmp/$emailfile"; mkdir "$tmpdir"; my $parser = MIME::Parser->new(); $parser->decode_headers(1); $parser->output_dir("$tmpdir"); my $message = $parser->parse_open("$email");
Two things. The name is wrong and the suffix is wrong. I can live with the suffix being wrong but it does point to possibly the problem being with the content-type being something MIME::Parser doesn't fully recognise. Anyone come across anything like this? Anyone solve it?Copy of 150173.xls
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Problem with MIME::Parser and filenames
by tangent (Parson) on Oct 10, 2017 at 21:40 UTC | |
by Laurielounge (Acolyte) on Oct 10, 2017 at 23:12 UTC | |
by tangent (Parson) on Oct 11, 2017 at 00:27 UTC | |
Re: Problem with MIME::Parser and filenames
by huck (Prior) on Oct 11, 2017 at 02:07 UTC | |
Re: Problem with MIME::Parser and filenames
by choroba (Cardinal) on Oct 11, 2017 at 07:34 UTC |
Back to
Seekers of Perl Wisdom