Skip to content

Commit e59b086

Browse files
committed
fix(site): avoid constructing invalid apps url
1 parent 3014713 commit e59b086

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

site/src/utils/apps.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ export const createAppLinkHref = (
2929
}
3030

3131
if (appsHost && app.subdomain && app.subdomain_name) {
32-
const baseUrl = `${protocol}//${appsHost}`;
32+
const updatedHost = appsHost.replace("*", app.subdomain_name);
33+
const baseUrl = `${protocol}//${updatedHost}`;
3334
const url = new URL(baseUrl);
34-
url.hostname = appsHost.replace("*", app.subdomain_name);
3535
url.pathname = "/";
3636

3737
href = url.toString();

site/src/utils/portForward.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ export const portForwardURL = (
1313

1414
const subdomain = `${port}${suffix}--${agentName}--${workspaceName}--${username}`;
1515

16-
const baseUrl = `${location.protocol}//${host}`;
16+
const baseUrl = `${location.protocol}//${host.replace("*", subdomain)}`;
1717
const url = new URL(baseUrl);
18-
url.hostname = host.replace("*", subdomain);
1918

2019
return url.toString();
2120
};

0 commit comments

Comments
 (0)