I have a zip file (let's say 'inside.zip') inside another zip file (let's say 'outside.zip'). I am using Apache's common-vfs2 Java library and providing a uri like zip:file:///path/to/outside.zip
to open the zip file. However, it cannot open the zip file that exists inside outside.zip e.g. it says its a file not a folder and cannot find any children in zip:file:///path/to/outside.zip!/inside.zip
. What's the best way to use the library (I am looking for the right uri) so I can open the zip file inside another zip file?
Asked
Active
Viewed 1,877 times
4

pathikrit
- 32,469
- 37
- 142
- 221
1 Answers
7
After spending a day, figuring this out, this is the correct URI:
zip:zip:/path/to/outer.zip!/inner.zip!/
All of the following fails surprisingly:
zip:zip:/path/to/outer.zip!/inner.zip
zip:zip:/path/to/outer.zip!/inner.zip!
zip:/path/to/outer.zip!/inner.zip!/
Is there an RFC or a standard grammer for this that I can lookup to avoid nasty bugs like these?

pathikrit
- 32,469
- 37
- 142
- 221
-
Your middle failure case (`zip:zip:/path/to/outer.zip!/inner.zip!` -- with a trailing exclamation mark but no trailing slash) worked for me. The example `jar:zip:outer.zip!/nested.jar!/somedir` in the [documentation](http://commons.apache.org/proper/commons-vfs/filesystems.html#Zip_Jar_and_Tar) worked as well. However, given that one need not append an exclamation mark to list the inner content of the outer zip (i.e. `zip:/path/to/outer.zip`), it is counter-intuitive that one must append a second exclamation mark to list the inner content of any nested zips. – kostmo Dec 25 '13 at 01:04
-
It also works to list the inner contents of the outer zip with an exclamation mark appended (i.e. `zip:/path/to/outer.zip!`). So as a client, perhaps the most consistent thing to do is to always append the exclamation mark, even at the outer-most zip level where it seems to be implicit. – kostmo Dec 25 '13 at 01:11