diff --git a/.changeset/tall-mugs-press.md b/.changeset/tall-mugs-press.md new file mode 100644 index 0000000000..2a0053e95d --- /dev/null +++ b/.changeset/tall-mugs-press.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-backend-module-github': patch +--- + +Improved support for wildcards in `catalogPath` diff --git a/plugins/catalog-backend-module-github/src/providers/GitHubEntityProvider.ts b/plugins/catalog-backend-module-github/src/providers/GitHubEntityProvider.ts index 43c01e8f7c..991b380112 100644 --- a/plugins/catalog-backend-module-github/src/providers/GitHubEntityProvider.ts +++ b/plugins/catalog-backend-module-github/src/providers/GitHubEntityProvider.ts @@ -195,9 +195,9 @@ export class GitHubEntityProvider implements EntityProvider { private createLocationUrl(repository: Repository): string { const branch = this.config.filters?.branch || repository.defaultBranchRef?.name || '-'; - const catalogFile = this.config.catalogPath.substring( - this.config.catalogPath.lastIndexOf('/') + 1, - ); + const catalogFile = this.config.catalogPath.startsWith('/') + ? this.config.catalogPath.substring(1) + : this.config.catalogPath; return `${repository.url}/blob/${branch}/${catalogFile}`; }