Skip to content

Commit

Permalink
fix: change newFromTransport func failure (#2075)
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 c2c09a8 commit 93dd431
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions builder/sources/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,9 @@ func WrapTransport(transport http.RoundTripper, url, username, password string)
func newFromTransport(registryURL, username, password string, transport http.RoundTripper, logf LogfCallback) (*Registry, error) {
url := strings.TrimSuffix(registryURL, "/")
containsScheme := strings.HasPrefix(url, "https")
if !strings.HasPrefix(url, "https") && !strings.HasPrefix(url, "http") {
url = fmt.Sprintf("http://%s", registryURL)
if !containsScheme {
// use https by default
url = fmt.Sprintf("https://%s", registryURL)
}

if username != "" {
Expand Down

0 comments on commit 93dd431

Please sign in to comment.