From efda44a20b3713ba0fc2d324cc92cbbaa8a32ee6 Mon Sep 17 00:00:00 2001 From: David Valdez Date: Sun, 30 Apr 2023 17:17:59 -0500 Subject: [PATCH] Fix case of double slash --- ui/src/components/photoGallery/ProtectedMedia.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/src/components/photoGallery/ProtectedMedia.tsx b/ui/src/components/photoGallery/ProtectedMedia.tsx index 326217da..5b50bdd3 100644 --- a/ui/src/components/photoGallery/ProtectedMedia.tsx +++ b/ui/src/components/photoGallery/ProtectedMedia.tsx @@ -13,7 +13,10 @@ const placeholder = const getProtectedUrl = (url?: string) => { if (url == undefined) return undefined - const imgUrl = new URL(`${import.meta.env.BASE_URL}/${url}`, location.origin) + const imgUrl = new URL( + `${import.meta.env.BASE_URL}${url}`.replace(/\/\//g, '/'), + location.origin + ) const tokenRegex = location.pathname.match(/^\/share\/([\d\w]+)(\/?.*)$/) if (tokenRegex) {