Skip to content

Commit

Permalink
fix: create hub client failure (#2079)
Browse files Browse the repository at this point in the history
Signed-off-by: 张启航 <[email protected]>
  • Loading branch information
ZhangSetSail authored Nov 21, 2024
1 parent 7f9cc8b commit 2e5b5cd
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions builder/sources/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,9 @@ func newFromTransport(registryURL, username, password string, transport http.Rou
if containsScheme {
url = strings.Replace(url, "http", "https", 1)
}
logrus.Infof("username: %v", username)
if username != "" {
transport = WrapTransport(transport, url, username, password)
}
logrus.Infof("url: %v", url)
registry := &Registry{
URL: url,
Client: &http.Client{
Expand All @@ -131,12 +129,12 @@ func newFromTransport(registryURL, username, password string, transport http.Rou

if err := registry.Ping(); err != nil {
if err != nil {
logrus.Infof("---------in")
url = strings.Replace(url, "https", "http", 1)
if username != "" {
transport = WrapTransport(transport, url, username, password)
}
registry := &Registry{
URL: strings.Replace(url, "https", "http", 1),
URL: url,
Client: &http.Client{
Transport: transport,
},
Expand Down

0 comments on commit 2e5b5cd

Please sign in to comment.