diff --git a/plugins/catalog-backend-module-github/src/lib/github.ts b/plugins/catalog-backend-module-github/src/lib/github.ts index 7fc69d0f86..ef6a7f817a 100644 --- a/plugins/catalog-backend-module-github/src/lib/github.ts +++ b/plugins/catalog-backend-module-github/src/lib/github.ts @@ -273,7 +273,14 @@ export async function getOrganizationRepositories( org: string, catalogPath: string, ): Promise<{ repositories: Repository[] }> { - const catalogPathRef = `HEAD:${catalogPath}`; + let relativeCatalogPathRef: string; + // We must strip the leading slash or the query for objects does not work + if (catalogPath.startsWith('/')) { + relativeCatalogPathRef = catalogPath.substring(1); + } else { + relativeCatalogPathRef = catalogPath; + } + const catalogPathRef = `HEAD:${relativeCatalogPathRef}`; const query = ` query repositories($org: String!, $catalogPathRef: String!, $cursor: String) { repositoryOwner(login: $org) {