Closed FWDekker closed 5 years ago
I ran a quick test on a Mac and Ubuntu. The unzip
command leaves the colon intact. Is this a Windows only issue?
Would the NameMapper
help you? See the examples here https://github.com/zeroturnaround/zt-zip#extract-a-directory-from-a-zip-archive-including-the-directory-name
It is indeed a Windows-only issue since Windows doesn't allow colons in filenames. But the NameMapper
was able to solve the issue. Thanks!
When a directory in a zip has a colon (
:
) in its name, zt-zip will throw aZipException
when unzipping the archive. This is likely because colons are not allowed in paths on Windows.Other unzipping tools work around this issue by replacing the colon with an underscore (e.g. 7zip) or two underscores (e.g. Windows' native unzipping tool). I would expect zt-zip to behave similarly.
Note that files in a zip with a colon in the name are not a problem for zt-zip; it will simply truncate the filename starting from the colon.
Sample setup
Zip
The following zip will trigger the exception when it is unpacked: zip.zip
Code
I used the following code to unpack the zip:
Exception
The following exception was thrown: