Making it up as I go along

Volume 5, Issue 20; 24 Aug 2021

URIs for files inside ZIP archives on .NET. I think.

Supporting ZIP files as catalogs was motivated in part by the absence of anything like the classpath on .NET. It seems to be working fine on the Java side of the house where there’s a “standard” scheme that I can use to point into ZIP files, jar:.

If I want to refer to the catalog.xml file in /path/to/, I can use jar:f​ile:///path/to/!/catalog.xml. That passes through the machinery just fine.

It’s a lot less clear (to me) what the right answer is on .NET. Here’s my best guess, and what I’ve implemented: pack://file%3A,,,path,to, I don’t actually think that the underlying .NET APIs would do the right thing with that, but in fact it doesn’t really matter for this application.

The XML Resolver computes a URI of that form for the ZIP catalog, and knows how to open it. Using that as the base URI for the catalog file means that URIs of that form will be constructed for the other files in the ZIP file.

Because of the (generally unfortunate, but perhaps in this case working in my favor) design of the .NET GetEntity API, none of these URIs ever escape into the wild.

So I think it’ll all be ok. Tests will tell!