Fixed parseUrl to output catalogPaths beginning with '/'
This commit is contained in:
@@ -33,14 +33,14 @@ describe('GithubDiscoveryProcessor', () => {
|
||||
).toEqual({
|
||||
org: 'foo',
|
||||
repoSearchPath: /^proj$/,
|
||||
catalogPath: 'blob/master/catalog.yaml',
|
||||
catalogPath: '/blob/master/catalog.yaml',
|
||||
});
|
||||
expect(
|
||||
parseUrl('https://github.com/foo/proj*/blob/master/catalog.yaml'),
|
||||
).toEqual({
|
||||
org: 'foo',
|
||||
repoSearchPath: /^proj.*$/,
|
||||
catalogPath: 'blob/master/catalog.yaml',
|
||||
catalogPath: '/blob/master/catalog.yaml',
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ export class GithubDiscoveryProcessor implements CatalogProcessor {
|
||||
results.location(
|
||||
{
|
||||
type: 'url',
|
||||
target: `${repository.url}/${catalogPath}`,
|
||||
target: `${repository.url}${catalogPath}`,
|
||||
},
|
||||
false,
|
||||
),
|
||||
@@ -118,7 +118,7 @@ export function parseUrl(
|
||||
return {
|
||||
org: decodeURIComponent(path[0]),
|
||||
repoSearchPath: escapeRegExp(decodeURIComponent(path[1])),
|
||||
catalogPath: decodeURIComponent(path.slice(2).join('/')),
|
||||
catalogPath: `/${decodeURIComponent(path.slice(2).join('/'))}`,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user