From 5a37827e45f4922f434b85520569f2e2cc59b558 Mon Sep 17 00:00:00 2001 From: jonjohnsonjr Date: Wed, 28 Apr 2021 08:37:28 -0700 Subject: [PATCH] Fix gcrane top-level listing (#1005) Accidentally dropped top-level repo listing in gcrane for paginating responses. --- pkg/v1/google/list.go | 2 +- pkg/v1/google/list_test.go | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/v1/google/list.go b/pkg/v1/google/list.go index cf239cc5a..d85740861 100644 --- a/pkg/v1/google/list.go +++ b/pkg/v1/google/list.go @@ -127,7 +127,7 @@ func (l *lister) list(repo name.Repository) (*Tags, error) { return nil, err } - if len(parsed.Manifests) != 0 { + if len(parsed.Manifests) != 0 || len(parsed.Children) != 0 { // We're dealing with GCR, just return directly. return &parsed, nil } diff --git a/pkg/v1/google/list_test.go b/pkg/v1/google/list_test.go index 342acc62a..5718526a4 100644 --- a/pkg/v1/google/list_test.go +++ b/pkg/v1/google/list_test.go @@ -104,6 +104,13 @@ func TestList(t *testing.T) { }, Tags: []string{"foo", "bar", "baz"}, }, + }, { + name: "just children", + responseBody: []byte(`{"child":["hello", "world"]}`), + wantErr: false, + wantTags: &Tags{ + Children: []string{"hello", "world"}, + }, }, { name: "not json", responseBody: []byte("notjson"),