Skip to content

Commit

Permalink
Fixed discussion 27595 by checking that prefix is not api/
Browse files Browse the repository at this point in the history
  • Loading branch information
ManuelB committed Feb 29, 2024
1 parent f74ece1 commit d3eba65
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions lib/modules/datasource/go/base.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,29 @@ describe('modules/datasource/go/base', () => {
});
});

it('supports GitLab EE deps in private subgroup with api/ as part of packageName and api/v4 as part of endpoint', async () => {
GlobalConfig.set({ endpoint: 'https://my.custom.domain/api/v4' });

hostRules.hostType.mockReturnValue('gitlab');
httpMock
.scope('https://my.custom.domain')
.get('/group/subgroup-api/myrepo?go-get=1')
.reply(
200,
Fixtures.get('go-get-gitlab-ee-private-subgroup-api.html'),
);

const res = await BaseGoDatasource.getDatasource(
'my.custom.domain/group/subgroup-api/myrepo',
);

expect(res).toEqual({
datasource: GitlabTagsDatasource.id,
packageName: 'group/subgroup-api/myrepo',
registryUrl: 'https://my.custom.domain/',
});
});

it('supports GitLab EE deps in subgroup with version', async () => {
hostRules.hostType.mockReturnValue('gitlab');
httpMock
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/datasource/go/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export class BaseGoDatasource {
endpoint,
);

if (endpointPrefix) {
if (endpointPrefix && endpointPrefix[1] !== 'api/') {
packageName = packageName.replace(endpointPrefix[1], '');
}

Expand Down

0 comments on commit d3eba65

Please sign in to comment.