Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/contrib/issue/common/issueReporterUtil.ts
3296 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { rtrim } from '../../../../base/common/strings.js';
7
8
export function normalizeGitHubUrl(url: string): string {
9
// If the url has a .git suffix, remove it
10
if (url.endsWith('.git')) {
11
url = url.substr(0, url.length - 4);
12
}
13
14
// Remove trailing slash
15
url = rtrim(url, '/');
16
17
if (url.endsWith('/new')) {
18
url = rtrim(url, '/new');
19
}
20
21
if (url.endsWith('/issues')) {
22
url = rtrim(url, '/issues');
23
}
24
25
return url;
26
}
27
28