Merge pull request #8089 from junaid18183/master

Fixes repo parsing
This commit is contained in:
Adam Reese
2020-06-11 11:15:33 -07:00
committed by GitHub
2 changed files with 9 additions and 1 deletions

View File

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

View File

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