Strip leading slash if present in catalog path ref

Without this, the graphql query fails to return matching catalog paths

Signed-off-by: Nikolas Skoufis <nskoufis@seek.com.au>
This commit is contained in:
Nikolas Skoufis
2022-10-10 18:31:00 +11:00
parent 0f0bbd70fe
commit 4a5fd284ee
@@ -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) {