[Alpine-info] [PATCH] Attachment export extension handling
chris at aptivate.org
Tue Jul 19 03:48:16 PDT 2011
There seems to be a problematic interaction between Microsoft Office,
Eudora, Alpine and OpenOffice.
A user sent me a Word OOXML document, with a docx extension, using
"X-Mailer: QUALCOMM Windows Eudora Version 184.108.40.206". Eudora wrote the
following attachment MIME part:
Content-Type: application/msword; name="xxxxxxxTechTasksAptivate.docx";
Content-Disposition: attachment; filename="xxxxxxxTechTasksAptivate.docx"
Alpine (in alpine/mailpart.c) discards the original extension and uses the
one from the mailcap database. In my case, that says:
application/msword; soffice -no-oosplash -writer '%s'; edit=soffice
-no-oosplash -writer '%s'; test=test -n "$DISPLAY";
description="Microsoft Word Document"; nametemplate=%s.doc
So Alpine writes out a filename like
"/tmp/img-xxxxxxxTechTasksAptivate-20242.doc", i.e. using the extension
.doc instead of .docx, and then calls OpenOffice.
OpenOffice tries to open the file as an old-style Word document, not a
DOCX, because of the extension, and reports that the file is corrupt and
refuses to open it.
I'm not sure where the fault is. Perhaps application/msword is not valid
for docx files, so it was Eudora's fault. Perhaps OpenOffice should have
looked at the file contents instead of trusting the extension, to figure
out that it's actually a DOCX. However, Alpine gives me no option to
change the file name before viewing it, so having received such an email,
I'm stuck with it. This is not the only case of a mailer sending files
with bad MIME types; I think Outlook is a frequent offender.
I wrote the following quick patch to preserve the original extension on
the filename supplied by the sender, if any, overriding the official
extension in mailcap. I don't know if this is a security risk, but I hope
you will consider it for inclusion in Alpine.
Please let me know if I should submit this to a bug tracker somewhere, or
what else I can do to increase its chances of acceptance.
Aptivate | http://www.aptivate.org | Phone: +44 1223 760887
The Humanitarian Centre, Fenner's, Gresham Road, Cambridge CB1 2ES
Aptivate is a not-for-profit company registered in England and Wales
with company number 04980791.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 797 bytes
Url : http://mailman2.u.washington.edu/pipermail/alpine-info/attachments/20110719/55475ab2/alpine-attachment-view-extension-fix.bin
More information about the Alpine-info