|
|
|
@ -88,8 +88,15 @@ func NewClient(options ...ClientOption) (*Client, error) {
|
|
|
|
|
client.authorizer = authClient
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if client.resolver == nil {
|
|
|
|
|
resolverFn := client.resolver // copy for avoiding recursive call
|
|
|
|
|
client.resolver = func(ref registry.Reference) (remotes.Resolver, error) {
|
|
|
|
|
if resolverFn != nil {
|
|
|
|
|
// validate if the resolverFn returns a valid resolver
|
|
|
|
|
if resolver, err := resolverFn(ref); resolver != nil && err == nil {
|
|
|
|
|
return resolver, nil
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
headers := http.Header{}
|
|
|
|
|
headers.Set("User-Agent", version.GetUserAgent())
|
|
|
|
|
dockerClient, ok := client.authorizer.(*dockerauth.Client)
|
|
|
|
@ -119,7 +126,6 @@ func NewClient(options ...ClientOption) (*Client, error) {
|
|
|
|
|
}
|
|
|
|
|
return resolver, nil
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// allocate a cache if option is set
|
|
|
|
|
var cache registryauth.Cache
|
|
|
|
|