From 4dd18e379e29d6e82770d8d75b82ae43fa0da0c0 Mon Sep 17 00:00:00 2001 From: MidoriKurage Date: Sun, 22 Mar 2026 11:40:25 +0800 Subject: [PATCH] fix(frontend): origUrlToCheck references the same object as urlToCheck When later `urlToCheck` is restored in catch blocks, `origUrlToCheck` will already be mutated. Fixed by storing the original pathname as a string copy instead of keeping a reference to the same URL object. --- frontend/src/helpers/checkAndSetApiUrl.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/helpers/checkAndSetApiUrl.ts b/frontend/src/helpers/checkAndSetApiUrl.ts index b60886b50..278f97a08 100644 --- a/frontend/src/helpers/checkAndSetApiUrl.ts +++ b/frontend/src/helpers/checkAndSetApiUrl.ts @@ -46,7 +46,7 @@ export const checkAndSetApiUrl = (pUrl: string | undefined | null): Promise { // Check if it is reachable at /api/v1 and https - urlToCheck.pathname = origUrlToCheck.pathname + urlToCheck.pathname = origPathname if ( !urlToCheck.pathname.endsWith('/api/v1') && !urlToCheck.pathname.endsWith('/api/v1/') @@ -92,7 +92,7 @@ export const checkAndSetApiUrl = (pUrl: string | undefined | null): Promise { // Check if it is reachable at :API_DEFAULT_PORT and /api/v1 - urlToCheck.pathname = origUrlToCheck.pathname + urlToCheck.pathname = origPathname if ( !urlToCheck.pathname.endsWith('/api/v1') && !urlToCheck.pathname.endsWith('/api/v1/')