diff --git a/client-v3/src/js/platform/browser.ts b/client-v3/src/js/platform/browser.ts index 1ac2a2ea..84d05d71 100644 --- a/client-v3/src/js/platform/browser.ts +++ b/client-v3/src/js/platform/browser.ts @@ -10,7 +10,7 @@ * @returns {string} Base URL (e.g., "http://localhost:8080") */ export function baseURL(): string { - return `${window.location.protocol}//${window.location.hostname}:${window.location.port}`; + return `${window.location.protocol}//${window.location.hostname}${window.location.port ? ':' + window.location.port : ''}`; } export function makeURL(path: string): string { diff --git a/client/src/js/platform/browser.test.ts b/client/src/js/platform/browser.test.ts index 79edf07e..21b31990 100644 --- a/client/src/js/platform/browser.test.ts +++ b/client/src/js/platform/browser.test.ts @@ -39,7 +39,7 @@ describe('browser.js', () => { window.location.port = ''; const result = baseURL(); - expect(result).toBe('http://localhost:'); + expect(result).toBe('http://localhost'); }); }); diff --git a/client/src/js/platform/browser.ts b/client/src/js/platform/browser.ts index 1ac2a2ea..84d05d71 100644 --- a/client/src/js/platform/browser.ts +++ b/client/src/js/platform/browser.ts @@ -10,7 +10,7 @@ * @returns {string} Base URL (e.g., "http://localhost:8080") */ export function baseURL(): string { - return `${window.location.protocol}//${window.location.hostname}:${window.location.port}`; + return `${window.location.protocol}//${window.location.hostname}${window.location.port ? ':' + window.location.port : ''}`; } export function makeURL(path: string): string {