From 1038f6ff10f03edccc10fae240a9225c4a177f20 Mon Sep 17 00:00:00 2001 From: Viktor Belomestnov Date: Mon, 20 May 2024 10:33:53 +0200 Subject: [PATCH] fix(i3s): slpk full path on Windows (#3011) --- modules/i3s/src/lib/utils/url-utils.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/i3s/src/lib/utils/url-utils.ts b/modules/i3s/src/lib/utils/url-utils.ts index 95d93f9305..dc7073e8bb 100644 --- a/modules/i3s/src/lib/utils/url-utils.ts +++ b/modules/i3s/src/lib/utils/url-utils.ts @@ -6,13 +6,18 @@ import {Node3DIndexDocument, SceneLayer3D} from '../../types'; * @returns url without search params */ export function getUrlWithoutParams(url: string): string { - let urlWithoutParams; + let urlWithoutParams: string | null; try { const urlObj = new URL(url); urlWithoutParams = `${urlObj.origin}${urlObj.pathname}`; + + // On Windows `new URL(url)` makes `C:\...` -> `null\...` + if (urlWithoutParams.startsWith('null')) { + urlWithoutParams = null; + } } catch (e) { - // do nothing + urlWithoutParams = null; } return urlWithoutParams || url; }