diff --git a/internal/experimental/registry/reference.go b/internal/experimental/registry/reference.go index ced6cf33a..ebab29a7e 100644 --- a/internal/experimental/registry/reference.go +++ b/internal/experimental/registry/reference.go @@ -86,6 +86,7 @@ func (ref *Reference) FullName() string { // validate makes sure the ref meets our criteria func (ref *Reference) validate() error { + err := ref.validateRepo() if err != nil { return err @@ -100,7 +101,7 @@ func (ref *Reference) validateRepo() error { } // Makes sure the repo results in a parsable URL (similar to what is done // with containerd reference parsing) - _, err := url.Parse(ref.Repo) + _, err := url.Parse("//" + ref.Repo) return err } diff --git a/internal/experimental/registry/reference_test.go b/internal/experimental/registry/reference_test.go index bb53ebab8..aae03ad99 100644 --- a/internal/experimental/registry/reference_test.go +++ b/internal/experimental/registry/reference_test.go @@ -81,6 +81,13 @@ func TestParseReference(t *testing.T) { is.Equal("1.5.0", ref.Tag) is.Equal("myrepo:5001/mychart:1.5.0", ref.FullName()) + s = "127.0.0.1:5001/mychart:1.5.0" + ref, err = ParseReference(s) + is.NoError(err) + is.Equal("127.0.0.1:5001/mychart", ref.Repo) + is.Equal("1.5.0", ref.Tag) + is.Equal("127.0.0.1:5001/mychart:1.5.0", ref.FullName()) + s = "localhost:5000/mychart:latest" ref, err = ParseReference(s) is.NoError(err)