Opened 18 years ago
Closed 18 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)
Change History (4)
by , 18 years ago
Attachment: | zipfix.patch added |
---|
follow-up: 2 comment:1 by , 18 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).
comment:2 by , 18 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.
Remove leading / from archived file names