mail.app and zip file attachments

[prev] [thread] [next] [lurker] [Date index for 2004/03/03]

From: Nicholas Clark
Subject: mail.app and zip file attachments
Date: 11:21 on 03 Mar 2004
So I've been forwarded a message, and it contains a zip file attachment.
However, said zipfile has been made by hateful software, which has used
backslashes instead of forward slashes as directory separators in the internal
filenames. Strictly there is nothing wrong - the legal zip file contains
files at the top level named

 foo\bar
 foo\baz

etc, but the intent was clearly

 foo/
     bar
     baz

Now, I know that Infozip's unzip program is not hateful, and is smart enough
to allow compensation for this hatefulness.

However, can I get mail.app to save the attachment as a zip file? No way!
Whatever I try, it insists on "helpfully" unzipping it for me. And it
(correctly, but unhelpfully) takes a literal view on those backslashes. So
I get crappy filenames with 3 levels of directory trees flattenened

Oi! No. Stop trying to be clever, and let me detach the attachment still as
a zip file.

The only way the collective brains round here could outsmart the hateware
was by saving the message in raw form (OK. at least it lets us do that,
but hatefully it did put [] in the filename it made from the subject line)
and I used a REAL mail program (ie mutt) to save the zip attachment.

At which point unzip can do its magic:

$ unzip  Localization-10-30-2003-6.22.57.PM.zip 
Archive:  Localization-10-30-2003-6.22.57.PM.zip
warning:  Localization-10-30-2003-6.22.57.PM.zip appears to use backslashes as path separators


Wah. I think I have a solution. I could just mail Apple 42.zip as an
attachment:

$ unzip -l 42.zip
Archive:  42.zip
 Length    Date    Time    Name
 ------    ----    ----    ----
  34902  03-28-00  21:40   lib 3.zip
  34902  03-28-00  21:40   lib 1.zip
  34902  03-28-00  21:40   lib 2.zip
  34902  03-28-00  21:40   lib 0.zip
  34902  03-28-00  21:40   lib 4.zip
  34902  03-28-00  21:40   lib 5.zip
  34902  03-28-00  21:40   lib 6.zip
  34902  03-28-00  21:40   lib 7.zip
  34902  03-28-00  21:40   lib 8.zip
  34902  03-28-00  21:40   lib 9.zip
  34902  03-28-00  21:40   lib a.zip
  34902  03-28-00  21:40   lib b.zip
  34902  03-28-00  21:40   lib c.zip
  34902  03-28-00  21:40   lib d.zip
  34902  03-28-00  21:40   lib e.zip
  34902  03-28-00  21:40   lib f.zip
 ------                    -------
 558432                    16 files

(etc, etc, etc)
That'll teach them not to trust zip files.

Nicholas Clark

Generated at 14:02 on 01 Jul 2004 by mariachi 0.52