Skip to content

Commit

Permalink
fix(platform/gerrit): URI encode branch in gerrit's getFile() (#30753)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwoe authored Aug 14, 2024
1 parent eccb4d5 commit d554483
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/modules/platform/gerrit/client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,11 +415,11 @@ describe('modules/platform/gerrit/client', () => {
httpMock
.scope(gerritEndpointUrl)
.get(
'/a/projects/test%2Frepo/branches/main/files/renovate.json/content',
'/a/projects/test%2Frepo/branches/base%2Fbranch/files/renovate.json/content',
)
.reply(200, gerritFileResponse('{}'));
await expect(
client.getFile('test/repo', 'main', 'renovate.json'),
client.getFile('test/repo', 'base/branch', 'renovate.json'),
).resolves.toBe('{}');
});
});
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/platform/gerrit/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class GerritClient {
const base64Content = await this.gerritHttp.get(
`a/projects/${encodeURIComponent(
repo,
)}/branches/${branch}/files/${encodeURIComponent(fileName)}/content`,
)}/branches/${encodeURIComponent(branch)}/files/${encodeURIComponent(fileName)}/content`,
);
return Buffer.from(base64Content.body, 'base64').toString();
}
Expand Down

0 comments on commit d554483

Please sign in to comment.