Subject: | Parsing issues in MIME::Parser $VERSION = "5.509"; |
Date: | Tue, 8 Jan 2019 11:45:36 -0500 |
To: | bug-MIME-tools [...] rt.cpan.org |
From: | Bill Hess <bhess [...] techrg.com> |
We have an internal time card system which reads email and looks for XLS or
XLSX files
The code parses the XLS/XLSX file and extracts info and updates our DB
A time card was sent in as an attachment with the name "Jan 1 & 2 19.xlsx"
I am thinking the '&' is throwing something off??
See the output from dump_skeleton below in bold where the temp file name is
.xls but the recommended name is xlsx.
The code currently looks at the extension of the tmp file to open it as a
XLS or XLSX
I know that is probably not the best assumption to make - so changing
things up a bit to handle this better...
The email header from Gmail looks like this:
--_000_60A5B370BB455347AE4DD95829BAB45ABD0DF6usnosmx03usenaebe_--
--_004_60A5B370BB455347AE4DD95829BAB45ABD0DF6usnosmx03usenaebe_
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;
name="Jan 1 & 2 19.xlsx"
Content-Description: Jan 1 & 2 19.xlsx
Content-Disposition: attachment; filename="Jan 1 & 2 19.xlsx";
size=26447; creation-date="Tue, 08 Jan 2019 15:00:07 GMT";
modification-date="Tue, 08 Jan 2019 15:00:07 GMT"
Content-Transfer-Encoding: base64
--_004_60A5B370BB455347AE4DD95829BAB45ABD0DF6usnosmx03usenaebe_--
I build perl from source and use cpan to add/update modules
This is perl 5, version 20, subversion 3 (v5.20.3) built for
x86_64-linux-thread-multi
Content-type: multipart/mixed
Effective-type: multipart/mixed
Body-file: NONE
Subject: Time card 01/01/19- 01/02/19
Num-parts: 2
--
Content-type: multipart/alternative
Effective-type: multipart/alternative
Body-file: NONE
Num-parts: 2
--
Content-type: text/plain
Effective-type: text/plain
Body-file: /home/techrgtc/tmp/msg-1546963597-5196-0/msg-5196-1.txt
--
Content-type: text/html
Effective-type: text/html
Body-file: /home/techrgtc/tmp/msg-1546963597-5196-0/msg-5196-2.html
--
Content-type:
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Effective-type:
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
* Body-file: /home/techrgtc/tmp/msg-1546963597-5196-0/Jan 1 %26 2 19.xls*
* Recommended-filename: Jan 1 & 2 19.xlsx*
--
Please let me know if you have any questions - Thanks!
Bill Hess
248.703.1196