From 82034fe71cde2fcca57513557a5419f0bc3f7c4f Mon Sep 17 00:00:00 2001 From: Ivan Ilves Date: Wed, 21 Jul 2021 06:49:59 +0200 Subject: [PATCH] fix(issue-231): nil *Token pointer panic --- api/v1/registry/client/client.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/v1/registry/client/client.go b/api/v1/registry/client/client.go index 59f8f45..022645a 100644 --- a/api/v1/registry/client/client.go +++ b/api/v1/registry/client/client.go @@ -6,6 +6,7 @@ import ( "fmt" "io" "net/http" + "reflect" "time" log "github.com/sirupsen/logrus" @@ -176,7 +177,7 @@ func decodeAllTagData(body io.ReadCloser) ([]string, map[string]manifest.Manifes } func (cli *RegistryClient) repoToken(repoPath string) (auth.Token, error) { - if cli.Token != nil && cli.Token.Method() != "Bearer" { + if cli.Token != nil && !reflect.ValueOf(cli.Token).IsNil() && cli.Token.Method() != "Bearer" { return cli.Token, nil }