Skip to content

Commit 544c186

Browse files
committed
Escaped Zarr URL special characters except the slashes
1 parent d065d8e commit 544c186

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/lib/components/v2/projects/datasets/DatasetImagesTable.svelte

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,16 @@
611611
}
612612
return false;
613613
}
614+
615+
/**
616+
* @param {string} zarrUrl
617+
*/
618+
function encodePathForUrl(zarrUrl) {
619+
let encodedPath = encodeURIComponent(zarrUrl);
620+
// Replace encoded slashes back to slashes
621+
encodedPath = encodedPath.replace(/%2F/g, '/');
622+
return encodedPath;
623+
}
614624
</script>
615625
616626
{#if !showTable}
@@ -759,7 +769,9 @@
759769
{#if vizarrViewerUrl}
760770
<a
761771
class="btn btn-info"
762-
href="{vizarrViewerUrl}?source={vizarrViewerUrl}data{image.zarr_url}"
772+
href="{vizarrViewerUrl}?source={vizarrViewerUrl}data{encodePathForUrl(
773+
image.zarr_url
774+
)}"
763775
target="_blank"
764776
>
765777
<i class="bi bi-eye" />

0 commit comments

Comments
 (0)