so

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/my.zip, I can use jar:f​ile:///path/to/my.zip!/catalog.xml. That passes through the java.net.URI 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,my.zip/catalog.xml. 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!

Please provide your name and email address. Your email address will not be displayed and I won’t spam you, I promise. Your name and a link to your web address, if you provide one, will be displayed.

Your name:

Your email:

Homepage:

Do you comprehend the words on this page? (Please demonstrate that you aren't a mindless, screen-scraping robot.)

What is six plus one?   (e.g. six plus two is 8)

Enter your comment in the box below. You may style your comment with the CommonMark flavor of Markdown.

All comments are moderated. I don’t promise to preserve all of your formatting and I reserve the right to remove comments for any reason.