Merge pull request #8089 from junaid18183/master

Fixes repo parsing
pull/8131/head
Adam Reese 5 years ago committed by GitHub
commit a01adcebfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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
}

@ -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)

Loading…
Cancel
Save