Skip to content

fix: use url-parse for url construction #15670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Nov 27, 2024
Prev Previous commit
Next Next commit
fmt
  • Loading branch information
sreya committed Nov 27, 2024
commit ec8bea288cd6b659d2e73b2970ed754858f6db31
10 changes: 5 additions & 5 deletions site/src/utils/apps.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type * as TypesGen from "api/typesGenerated";
import URLParse from 'url-parse';
import URLParse from "url-parse";

export const createAppLinkHref = (
protocol: string,
Expand Down Expand Up @@ -30,10 +30,10 @@ export const createAppLinkHref = (
}

if (appsHost && app.subdomain && app.subdomain_name) {
const url = new URLParse('');
url.set('protocol', protocol);
url.set('hostname', appsHost.replace('*', app.subdomain_name));
url.set('pathname', '/');
const url = new URLParse("");
url.set("protocol", protocol);
url.set("hostname", appsHost.replace("*", app.subdomain_name));
url.set("pathname", "/");

href = url.toString();
}
Expand Down
10 changes: 5 additions & 5 deletions site/src/utils/portForward.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { WorkspaceAgentPortShareProtocol } from "api/typesGenerated";
import URLParse from 'url-parse';
import URLParse from "url-parse";

export const portForwardURL = (
host: string,
Expand All @@ -13,10 +13,10 @@ export const portForwardURL = (
const suffix = protocol === "https" ? "s" : "";

const subdomain = `${port}${suffix}--${agentName}--${workspaceName}--${username}`;
const url = new URLParse('');
url.set('protocol', location.protocol);
url.set('hostname', host.replace('*', subdomain));
const url = new URLParse("");
url.set("protocol", location.protocol);
url.set("hostname", host.replace("*", subdomain));

return url.toString();
};

Expand Down
Loading