Skip to content

Commit

Permalink
fix(issue-231): nil *Token pointer panic
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanilves committed Jul 21, 2021
1 parent a7d5143 commit 82034fe
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/v1/registry/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"io"
"net/http"
"reflect"
"time"

log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 82034fe

Please sign in to comment.