Commit 8867e744 authored by Michael Yang's avatar Michael Yang
Browse files

types/model: fix name for hostport

parent a3e60d90
...@@ -143,7 +143,11 @@ func ParseNameBare(s string) Name { ...@@ -143,7 +143,11 @@ func ParseNameBare(s string) Name {
n.RawDigest = MissingPart n.RawDigest = MissingPart
} }
s, n.Tag, _ = cutPromised(s, ":") // "/" is an illegal tag character, so we can use it to split the host
if strings.LastIndex(s, ":") > strings.LastIndex(s, "/") {
s, n.Tag, _ = cutPromised(s, ":")
}
s, n.Model, promised = cutPromised(s, "/") s, n.Model, promised = cutPromised(s, "/")
if !promised { if !promised {
n.Model = s n.Model = s
......
...@@ -34,6 +34,14 @@ func TestParseNameParts(t *testing.T) { ...@@ -34,6 +34,14 @@ func TestParseNameParts(t *testing.T) {
Model: "model", Model: "model",
}, },
}, },
{
in: "host:12345/namespace/model",
want: Name{
Host: "host:12345",
Namespace: "namespace",
Model: "model",
},
},
{ {
in: "namespace/model", in: "namespace/model",
want: Name{ want: Name{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment