chore: rollback issue with wildcard paths
Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-catalog-backend': patch
|
||||
---
|
||||
|
||||
Rollback the change for wildcard discovery, this fixes a bug with the `AzureUrlReader` not working with wildcard paths
|
||||
@@ -213,34 +213,4 @@ describe('UrlReaderProcessor', () => {
|
||||
|
||||
expect(reader.search).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('parser return valid URL with wildcard *', async () => {
|
||||
const logger = getVoidLogger();
|
||||
|
||||
const reader: jest.Mocked<UrlReader> = {
|
||||
readUrl: jest.fn(),
|
||||
readTree: jest.fn(),
|
||||
search: jest.fn().mockImplementation(async () => []),
|
||||
};
|
||||
|
||||
const processor = new UrlReaderProcessor({ reader, logger });
|
||||
|
||||
const emit = jest.fn();
|
||||
|
||||
await processor.readLocation(
|
||||
{
|
||||
type: 'url',
|
||||
target: 'https://storage.cloud.google.com/ah-backstage-poc-catalog/*',
|
||||
},
|
||||
false,
|
||||
emit,
|
||||
defaultEntityDataParser,
|
||||
mockCache,
|
||||
);
|
||||
|
||||
expect(reader.search).toHaveBeenCalledWith(
|
||||
'https://storage.cloud.google.com/ah-backstage-poc-catalog/*',
|
||||
{ etag: undefined },
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -20,6 +20,7 @@ import { assertError } from '@backstage/errors';
|
||||
import limiterFactory from 'p-limit';
|
||||
import { Logger } from 'winston';
|
||||
import { LocationSpec } from '@backstage/plugin-catalog-common';
|
||||
import parseGitUrl from 'git-url-parse';
|
||||
import {
|
||||
CatalogProcessor,
|
||||
CatalogProcessorCache,
|
||||
@@ -124,7 +125,7 @@ export class UrlReaderProcessor implements CatalogProcessor {
|
||||
// Does it contain globs? I.e. does it contain asterisks or question marks
|
||||
// (no curly braces for now)
|
||||
|
||||
const { pathname: filepath } = new URL(location);
|
||||
const { filepath } = parseGitUrl(location);
|
||||
if (filepath?.match(/[*?]/)) {
|
||||
const limiter = limiterFactory(5);
|
||||
const response = await this.options.reader.search(location, { etag });
|
||||
|
||||
Reference in New Issue
Block a user