Pārlūkot izejas kodu

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 pirms 2 gadiem
revīziju iesūtīja Eric Amodio
vecāks
revīzija
8323ae44d0
1 mainītis faili ar 5 papildinājumiem un 5 dzēšanām
  1. +5
    -5
      src/git/remotes/gitlab.ts

+ 5
- 5
src/git/remotes/gitlab.ts Parādīt failu

@ -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}`;
}
}

Notiek ielāde…
Atcelt
Saglabāt