fix issue#6977

Signed-off-by: caixiaojian <mc02cxj@gmail.com>
pull/7236/head
xiaojian cai 6 years ago committed by caixiaojian
parent 0fd76b2a2b
commit 52f4ad2f01

@ -100,7 +100,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
}

@ -109,6 +109,13 @@ func TestParseReference(t *testing.T) {
is.Equal("123", ref.Tag)
is.Equal("localhost:5000/x/y/z:123", ref.FullName())
s = "10.21.134.123:5000/x/y/z:latest"
ref, err = ParseReference(s)
is.NoError(err)
is.Equal("10.21.134.123:5000/x/y/z", ref.Repo)
is.Equal("latest", ref.Tag)
is.Equal("10.21.134.123:5000/x/y/z:latest", ref.FullName())
s = "localhost:5000/x/y/z:123:x"
_, err = ParseReference(s)
is.Error(err, "ref contains too many colons (3)")

Loading…
Cancel
Save