Compute the "base URL" the browser should start at, given a current
dataset URL (which may itself end in .zarr or .zarr.zip and therefore
live one directory below the listing target).
Logic:
empty / falsy URL: return ${origin}/ (top of the configured
server).
URL ending in .zarr, .zarr/, or .zarr.zip: strip the trailing
dataset segment so we list the directory containing the dataset.
otherwise: return origin + pathname unchanged.
on parse failure: return the input verbatim (defensive — the
caller does not need to handle the throw).
Compute the "base URL" the browser should start at, given a current dataset URL (which may itself end in
.zarror.zarr.zipand therefore live one directory below the listing target).Logic:
${origin}/(top of the configured server)..zarr,.zarr/, or.zarr.zip: strip the trailing dataset segment so we list the directory containing the dataset.origin + pathnameunchanged.