Edgewall Software
Modify

Opened 17 years ago

Closed 17 years ago

#4867 closed defect (fixed)

Zip files cannot be read with Windows unarchiver

Reported by: Emmanuel Blot Owned by: Christian Boos
Priority: low Milestone: 0.11
Component: version control/changeset view Version: devel
Severity: normal Keywords: zip
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

The default Windows zip unarchiver (Win XP) fails to manage ZIP archives produced by Trac from the Changeset view.

When such an archive is open, the archive appears to be empty, whereas it actually contains the zipped files.

When a third party tools such as IZarc is used to browse the archive content, the files appear in a unamed directory - the top level directory name seems to be empty.

It seems the issue is due to the way filenames are stored in the ZIP archive: the leading path separator seems to be the root cause of both these issues.

From a more general perspective, I don't think the leading / separator should be kept in a ZIP archive: it could be dangerous. tar unarchiver warns about such a situation (and discards the leading path separator when the TAR archive is inflated), so does the unzip tool:

blote@host:~/tmp/zip$ unzip ~/changeset_r2148.zip
Archive:  /home/blote/changeset_r2148.zip
warning:  stripped absolute path spec from /branches/t991b/.../activity.cpp
...

Attaching a patch that removes the leading path separator.

Let me know if you want me to commit it

Attachments (1)

zipfix.patch (892 bytes ) - added by Emmanuel Blot 17 years ago.
Remove leading / from archived file names

Download all attachments as: .zip

Change History (4)

by Emmanuel Blot, 17 years ago

Attachment: zipfix.patch added

Remove leading / from archived file names

comment:1 by Christian Boos, 17 years ago

Are you sure it's not the utf-8 encoding which is causing the issue with the default unarchiver?

Otherwise, stripping the leading "/" is a good idea (and you could actually use new_node.path.strip('/').encode('utf-8') for that).

in reply to:  1 comment:2 by Emmanuel Blot, 17 years ago

Replying to cboos:

Are you sure it's not the utf-8 encoding which is causing the issue with the default unarchiver?

I have not checked it but getting rid of the leading "/" fixed up the trouble and as the full pathname contains only ASCII characters the UTF-8 conversion should not alter the resulting pathname.

Otherwise, stripping the leading "/" is a good idea (and you could actually use new_node.path.strip('/').encode('utf-8') for that).

Yes, you're right.

comment:3 by Emmanuel Blot, 17 years ago

Resolution: fixed
Status: newclosed

Fix in [4937].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.