Skip to content

Commit 1422345

Browse files
authored
Revert "Sanitize input URL"
1 parent a6157e5 commit 1422345

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/git/repository.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,18 @@ export async function getGitHubUrls(): Promise<GitHubUrls[] | null> {
7575
remote = [r.state.remotes[0]];
7676
}
7777

78-
if (remote.length > 0 && remote[0].pushUrl) {
79-
const host = new URL(remote[0].pushUrl).host;
80-
const apiUri = new URL(getGitHubApiUri()).host;
81-
if (host === "github.com" || (useEnterprise() && host === apiUri)) {
82-
const url = remote[0].pushUrl;
83-
84-
return {
85-
workspaceUri: r.rootUri,
86-
url,
87-
protocol: new Protocol(url)
88-
};
89-
}
78+
if (
79+
remote.length > 0 &&
80+
(remote[0].pushUrl?.indexOf("github.com") !== -1 ||
81+
(useEnterprise() && remote[0].pushUrl?.indexOf(new URL(getGitHubApiUri()).host) !== -1))
82+
) {
83+
const url = remote[0].pushUrl;
84+
85+
return {
86+
workspaceUri: r.rootUri,
87+
url,
88+
protocol: new Protocol(url as string)
89+
};
9090
}
9191

9292
logDebug(`Remote "${remoteName}" not found, skipping repository`);

0 commit comments

Comments
 (0)