types/model: fix name for hostport
This commit is contained in:
parent
a3e60d9058
commit
8867e744ff
2 changed files with 13 additions and 1 deletions
|
@ -143,7 +143,11 @@ func ParseNameBare(s string) Name {
|
|||
n.RawDigest = MissingPart
|
||||
}
|
||||
|
||||
// "/" 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, "/")
|
||||
if !promised {
|
||||
n.Model = s
|
||||
|
|
|
@ -34,6 +34,14 @@ func TestParseNameParts(t *testing.T) {
|
|||
Model: "model",
|
||||
},
|
||||
},
|
||||
{
|
||||
in: "host:12345/namespace/model",
|
||||
want: Name{
|
||||
Host: "host:12345",
|
||||
Namespace: "namespace",
|
||||
Model: "model",
|
||||
},
|
||||
},
|
||||
{
|
||||
in: "namespace/model",
|
||||
want: Name{
|
||||
|
|
Loading…
Reference in a new issue