Skip to content

Commit

Permalink
fix: fix test case
Browse files Browse the repository at this point in the history
Signed-off-by: zongz <[email protected]>
  • Loading branch information
zong-zhe committed Jun 4, 2024
1 parent 0739548 commit 433c658
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions pkg/opt/opt.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,6 @@ func NewRegistryOptionsFrom(rawUrlorOciRef string, settings *settings.Settings)
parsedUrl.Scheme == constants.HttpScheme ||
parsedUrl.Scheme == constants.HttpsScheme {
ociOptions := NewOciOptionsFromUrl(parsedUrl)
if ociOptions == nil {
ociOptions, err = NewOciOptionsFromRef(rawUrlorOciRef, settings)
if err != nil {
return nil, err
}
}

if ociOptions != nil {
return &RegistryOptions{
Expand All @@ -256,6 +250,18 @@ func NewRegistryOptionsFrom(rawUrlorOciRef string, settings *settings.Settings)
}
}

// If all the url are invalid, try to parse the options from the oci ref.
ociOptions, err := NewOciOptionsFromRef(rawUrlorOciRef, settings)
if err != nil {
return nil, err
}

if ociOptions != nil {
return &RegistryOptions{
Oci: ociOptions,
}, nil
}

return nil, fmt.Errorf("invalid dependencies source: %s", rawUrlorOciRef)
}

Expand Down

0 comments on commit 433c658

Please sign in to comment.