Skip to content

Commit

Permalink
fix(gitlab-tags): use URL.resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Jun 19, 2020
1 parent 9868134 commit c8cc375
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/datasource/gitlab-tags/__snapshots__/index.spec.ts.snap
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`datasource/gitlab-tags getReleases returns tags 1`] = `
exports[`datasource/gitlab-tags getReleases returns tags from custom registry 1`] = `
Object {
"releases": Array [
Object {
Expand All @@ -21,7 +21,7 @@ Object {
}
`;

exports[`datasource/gitlab-tags getReleases returns tags 2`] = `
exports[`datasource/gitlab-tags getReleases returns tags from custom registry 2`] = `
Array [
Object {
"headers": Object {
Expand All @@ -31,7 +31,7 @@ Array [
"user-agent": "https://github.com/renovatebot/renovate",
},
"method": "GET",
"url": "https://gitlab.company.com/api/v4/api/v4/projects/some%2Fdep2/repository/tags?per_page=100",
"url": "https://gitlab.company.com/api/v4/projects/some%2Fdep2/repository/tags?per_page=100",
},
]
`;
Expand Down
4 changes: 2 additions & 2 deletions lib/datasource/gitlab-tags/index.spec.ts
Expand Up @@ -8,7 +8,7 @@ describe('datasource/gitlab-tags', () => {
httpMock.setup();
});
describe('getReleases', () => {
it('returns tags', async () => {
it('returns tags from custom registry', async () => {
const body = [
{
name: 'v1.0.0',
Expand All @@ -26,7 +26,7 @@ describe('datasource/gitlab-tags', () => {
];
httpMock
.scope('https://gitlab.company.com')
.get('/api/v4/api/v4/projects/some%2Fdep2/repository/tags?per_page=100')
.get('/api/v4/projects/some%2Fdep2/repository/tags?per_page=100')
.reply(200, body);
const res = await getPkgReleases({
datasource,
Expand Down
6 changes: 5 additions & 1 deletion lib/datasource/gitlab-tags/index.ts
@@ -1,3 +1,4 @@
import URL from 'url';
import is from '@sindresorhus/is';
import { logger } from '../../logger';
import * as globalCache from '../../util/cache/global';
Expand Down Expand Up @@ -43,7 +44,10 @@ export async function getReleases({

try {
// tag
const url = `${depHost}/api/v4/projects/${urlEncodedRepo}/repository/tags?per_page=100`;
const url = URL.resolve(
depHost,
`/api/v4/projects/${urlEncodedRepo}/repository/tags?per_page=100`
);

gitlabTags = (
await gitlabApi.getJson<GitlabTag[]>(url, {
Expand Down

0 comments on commit c8cc375

Please sign in to comment.