Skip to content

Commit 3a76a0a

Browse files
committed
Implement review comment suggestion
1 parent d0c4f36 commit 3a76a0a

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

src/configuration/configuration.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,6 @@ export function useEnterprise(): boolean {
6868
return getConfiguration().get<boolean>(getSettingsKey("use-enterprise"), false);
6969
}
7070

71-
export function getGithubUri(): string {
72-
const apiUri = getGitHubApiUri();
73-
74-
if (apiUri === DEFAULT_GITHUB_API || apiUri.endsWith(".ghe.com")) {
75-
return apiUri.replace(/^(https?):\/\/api\./, "$1://");
76-
}
77-
78-
return apiUri.replace(/\/api\/v3$/, "");
79-
}
80-
8171
export function getGitHubApiUri(): string {
8272
if (!useEnterprise()) return DEFAULT_GITHUB_API;
8373
const base = getConfiguration().get<string>("github-enterprise.uri", DEFAULT_GITHUB_API).replace(/\/$/, "");

src/git/repository.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {Octokit} from "@octokit/rest";
44
import {canReachGitHubAPI} from "../api/canReachGitHubAPI";
55
import {handleSamlError} from "../api/handleSamlError";
66
import {getSession} from "../auth/auth";
7-
import {getGithubUri, getRemoteName, useEnterprise} from "../configuration/configuration";
7+
import {getGitHubApiUri, getRemoteName, useEnterprise} from "../configuration/configuration";
88
import {Protocol} from "../external/protocol";
99
import {logDebug, logError} from "../log";
1010
import {API, GitExtension, RefType, RepositoryState} from "../typings/git";
@@ -77,7 +77,8 @@ export async function getGitHubUrls(): Promise<GitHubUrls[] | null> {
7777
if (
7878
remote.length > 0 &&
7979
(remote[0].pushUrl?.indexOf("github.com") !== -1 ||
80-
(useEnterprise() && remote[0].pushUrl?.indexOf(new URL(getGithubUri()).host) !== -1))
80+
(useEnterprise() && remote[0].pushUrl?.indexOf(new URL(getGitHubApiUri()).host) !== -1) ||
81+
remote[0].pushUrl?.indexOf(".ghe.com") !== -1)
8182
) {
8283
const url = remote[0].pushUrl;
8384

0 commit comments

Comments
 (0)