Skip to content

Commit

Permalink
fix: add default scheme https
Browse files Browse the repository at this point in the history
Signed-off-by: zongz <[email protected]>
  • Loading branch information
zong-zhe committed Jun 5, 2024
1 parent 8b8d033 commit 20f945d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions pkg/opt/opt.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,7 @@ func NewRegistryOptionsFrom(rawUrlorOciRef string, settings *settings.Settings)
// NewGitOptionsFromUrl will parse the git options from the git url.
// https, http, git and ssh are supported.
func NewGitOptionsFromUrl(parsedUrl *url.URL) *GitOptions {
if parsedUrl.Scheme == "" {
return nil
}

if parsedUrl.Scheme == constants.GitScheme {
if parsedUrl.Scheme == "" || parsedUrl.Scheme == constants.GitScheme {
// go-getter do not supports git scheme, so we need to convert it to https scheme.
parsedUrl.Scheme = constants.HttpsScheme
}
Expand All @@ -297,7 +293,7 @@ func NewGitOptionsFromUrl(parsedUrl *url.URL) *GitOptions {
// https, http, oci is supported.
func NewOciOptionsFromUrl(parsedUrl *url.URL) *OciOptions {
if parsedUrl.Scheme == "" {
return nil
parsedUrl.Scheme = constants.HttpsScheme
}
return &OciOptions{
Reg: parsedUrl.Host,
Expand Down

0 comments on commit 20f945d

Please sign in to comment.