54
return GITHUB_DOT_COM_ENDPOINTS;
55
}
57
>
let uri: URI;
58
>
try {
59
>
uri = URI.parse(enterpriseUri);
60
>
} catch {
61
return GITHUB_DOT_COM_ENDPOINTS;
62
}
64
>
const authority = uri.authority;
65
>
if (!authority) {
66
return GITHUB_DOT_COM_ENDPOINTS;
67
}
69
>
// A github.com authority is never a GitHub Enterprise host — treat it as the
70
>
// default rather than deriving a nonsensical `github.com/api/v3`. Guards the
71
>
// case where the enterprise host can't be resolved and falls back to github.com.
72
if (authority === 'github.com' || authority === 'www.github.com' || authority === 'api.github.com') {
73
return GITHUB_DOT_COM_ENDPOINTS;