Merge a5fdfad6ff6b91bb4dcb8134638f6e0f4208289b into d7eb05b9361febead29a74e71ddffc2ebeff5302

This commit is contained in:
Andreas Jansson 2024-11-14 13:58:49 +08:00 committed by GitHub
commit 56b5571fbc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View File

@ -50,7 +50,7 @@ func ParseModelPath(name string) ModelPath {
}
name = strings.ReplaceAll(name, string(os.PathSeparator), "/")
parts := strings.Split(name, "/")
parts := strings.SplitN(name, "/", 3)
switch len(parts) {
case 3:
mp.Registry = parts[0]

View File

@ -143,6 +143,17 @@ func TestParseModelPath(t *testing.T) {
Tag: DefaultTag,
},
},
{
"path with more than three parts",
"https://example.com/ns/another-part/repo:tag",
ModelPath{
ProtocolScheme: "https",
Registry: "example.com",
Namespace: "ns",
Repository: "another-part/repo",
Tag: "tag",
},
},
}
for _, tc := range tests {