hms-dbmi / viv

Library for multiscale visualization of high-resolution multiplexed bioimaging data on the web. Directly renders Zarr and OME-TIFF.
http://avivator.gehlenborglab.org
MIT License
274 stars 42 forks source link

`loadOmeTiff` with relative path no longer works #756

Open xinaesthete opened 9 months ago

xinaesthete commented 9 months ago

Describe the bug This is fairly trivial, but it used to be possible to call something like loadOmeTiff('/api/image.ome.tiff'). This now throws an exception when it passes that string to new URL(source) (here). I can work around this at my end by being more careful about forming a working string or URL... so now in my client code I have something like this

if (source.startsWith('/')) source = new URL(source, window.location.href)
loadOmeTiff(source)

That's not a totally robust method, but a passable hack for me for now... but it was a breaking change for me when I updated to the latest Viv version, so maybe worth considering (and probably source.startsWith('/') won't catch all potential problems).