From 82fd89e64a5000670a4efbda9356c87590d97058 Mon Sep 17 00:00:00 2001 From: Tim Burks Date: Mon, 14 Aug 2023 10:08:55 -0700 Subject: [PATCH] Trim the "@-" suffix from resource names before calling the List*Revisions APIs. (#1218) --- pkg/visitor/list.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/visitor/list.go b/pkg/visitor/list.go index 6197c982a..6d5606791 100644 --- a/pkg/visitor/list.go +++ b/pkg/visitor/list.go @@ -17,6 +17,7 @@ package visitor import ( "context" "fmt" + "strings" "github.com/apigee/registry/cmd/registry/compress" "github.com/apigee/registry/gapic" @@ -132,7 +133,8 @@ func ListDeploymentRevisions(ctx context.Context, filter string, handler DeploymentHandler) error { it := client.ListApiDeploymentRevisions(ctx, &rpc.ListApiDeploymentRevisionsRequest{ - Name: name.String(), + // "@-" indicates a collection of revisions, but we only want to send the resource name to the List RPC. + Name: strings.TrimSuffix(name.String(), "@-"), PageSize: pageSize, Filter: filter, }) @@ -234,7 +236,8 @@ func ListSpecRevisions(ctx context.Context, getContents bool, handler SpecHandler) error { it := client.ListApiSpecRevisions(ctx, &rpc.ListApiSpecRevisionsRequest{ - Name: name.String(), + // "@-" indicates a collection of revisions, but we only want to send the resource name to the List RPC. + Name: strings.TrimSuffix(name.String(), "@-"), PageSize: pageSize, Filter: filter, })