浏览代码

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}`
main
Brian Williams 2 年前
committed by Eric Amodio
父节点
当前提交
8323ae44d0
共有 1 个文件被更改,包括 5 次插入5 次删除
  1. +5
    -5
      src/git/remotes/gitlab.ts

+ 5
- 5
src/git/remotes/gitlab.ts 查看文件

@ -105,15 +105,15 @@ export class GitLabRemote extends RemoteProvider {
}
protected getUrlForBranches(): string {
return this.encodeUrl(`${this.baseUrl}/branches`);
return this.encodeUrl(`${this.baseUrl}/-/branches`);
}
protected getUrlForBranch(branch: string): string {
return this.encodeUrl(`${this.baseUrl}/tree/${branch}`);
return this.encodeUrl(`${this.baseUrl}/-/tree/${branch}`);
}
protected getUrlForCommit(sha: string): string {
return this.encodeUrl(`${this.baseUrl}/commit/${sha}`);
return this.encodeUrl(`${this.baseUrl}/-/commit/${sha}`);
}
protected override getUrlForComparison(base: string, compare: string, notation: '..' | '...'): string {
@ -132,8 +132,8 @@ export class GitLabRemote extends RemoteProvider {
line = '';
}
if (sha) return `${this.encodeUrl(`${this.baseUrl}/blob/${sha}/${fileName}`)}${line}`;
if (branch) return `${this.encodeUrl(`${this.baseUrl}/blob/${branch}/${fileName}`)}${line}`;
if (sha) return `${this.encodeUrl(`${this.baseUrl}/-/blob/${sha}/${fileName}`)}${line}`;
if (branch) return `${this.encodeUrl(`${this.baseUrl}/-/blob/${branch}/${fileName}`)}${line}`;
return `${this.encodeUrl(`${this.baseUrl}?path=${fileName}`)}${line}`;
}
}

正在加载...
取消
保存