Skip to content

Commit

Permalink
fix(i3s): slpk full path on Windows (#3011)
Browse files Browse the repository at this point in the history
  • Loading branch information
belom88 committed May 20, 2024
1 parent acd10a2 commit 1038f6f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions modules/i3s/src/lib/utils/url-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 1038f6f

Please sign in to comment.