Skip to content

Commit 1d4675d

Browse files
authored
GitLab: Changes for nested project groups can now be fetched (#25)
1 parent ac4e1a7 commit 1d4675d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/scm.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -511,10 +511,12 @@ class Gitlab extends BaseScmAdapter {
511511
parents: { sha: string }[];
512512
files: CommonChange[];
513513
}> {
514+
const namespace = encodeURIComponent(
515+
`${commitInfo.owner}/${commitInfo.repo}`,
516+
);
517+
514518
// get project id
515-
const commitUrl = `${this.getApiUrl()}/projects/${commitInfo.owner}%2F${
516-
commitInfo.repo
517-
}/repository/commits/${commitInfo.commitHash}`;
519+
const commitUrl = `${this.getApiUrl()}/projects/${namespace}/repository/commits/${commitInfo.commitHash}`;
518520

519521
let response = await fetch(commitUrl, {
520522
headers: this.createHeaders(token),
@@ -527,9 +529,7 @@ class Gitlab extends BaseScmAdapter {
527529
}
528530
const commitData = await response.json();
529531

530-
const diffUrl = `${this.getApiUrl()}/projects/${commitInfo.owner}%2F${
531-
commitInfo.repo
532-
}/repository/commits/${commitInfo.commitHash}/diff`;
532+
const diffUrl = `${this.getApiUrl()}/projects/${namespace}/repository/commits/${commitInfo.commitHash}/diff`;
533533

534534
response = await fetch(diffUrl, {
535535
headers: this.createHeaders(token),

0 commit comments

Comments
 (0)