Skip to content

Commit 8323ae4

Browse files
Brcrwilliamseamodio
authored andcommitted
Fixes #2021 - Use scoped routes for GitLab URLs
GitLens uses legacy project routes for GitLab: - `${projectURL}/branches` - `${projectURL}/tree/${branch}` - `${projectURL}/commit/${sha}` - `${projectURL}/compare/${base}${notation}${compare}` - `${projectURL}/blob/${ref}/${fileName}` These routes are all deprecated and scheduled for removal. See these references: - https://docs.gitlab.com/ee/development/routing.html#project-routes - https://gitlab.com/gitlab-org/gitlab/-/issues/118849 - https://gitlab.com/gitlab-org/gitlab/-/issues/28848 This change replaces them with the following scoped routes: - `${projectURL}/-/branches` - `${projectURL}/-/tree/${branch}` - `${projectURL}/-/commit/${sha}` - `${projectURL}/-/compare/${base}${notation}${compare}` - `${projectURL}/-/blob/${ref}/${fileName}`
1 parent 06f2576 commit 8323ae4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/git/remotes/gitlab.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,15 @@ export class GitLabRemote extends RemoteProvider {
105105
}
106106

107107
protected getUrlForBranches(): string {
108-
return this.encodeUrl(`${this.baseUrl}/branches`);
108+
return this.encodeUrl(`${this.baseUrl}/-/branches`);
109109
}
110110

111111
protected getUrlForBranch(branch: string): string {
112-
return this.encodeUrl(`${this.baseUrl}/tree/${branch}`);
112+
return this.encodeUrl(`${this.baseUrl}/-/tree/${branch}`);
113113
}
114114

115115
protected getUrlForCommit(sha: string): string {
116-
return this.encodeUrl(`${this.baseUrl}/commit/${sha}`);
116+
return this.encodeUrl(`${this.baseUrl}/-/commit/${sha}`);
117117
}
118118

119119
protected override getUrlForComparison(base: string, compare: string, notation: '..' | '...'): string {
@@ -132,8 +132,8 @@ export class GitLabRemote extends RemoteProvider {
132132
line = '';
133133
}
134134

135-
if (sha) return `${this.encodeUrl(`${this.baseUrl}/blob/${sha}/${fileName}`)}${line}`;
136-
if (branch) return `${this.encodeUrl(`${this.baseUrl}/blob/${branch}/${fileName}`)}${line}`;
135+
if (sha) return `${this.encodeUrl(`${this.baseUrl}/-/blob/${sha}/${fileName}`)}${line}`;
136+
if (branch) return `${this.encodeUrl(`${this.baseUrl}/-/blob/${branch}/${fileName}`)}${line}`;
137137
return `${this.encodeUrl(`${this.baseUrl}?path=${fileName}`)}${line}`;
138138
}
139139
}

0 commit comments

Comments
 (0)