diff --git a/server/modelpath.go b/server/modelpath.go index d498c467..c7cf04b7 100644 --- a/server/modelpath.go +++ b/server/modelpath.go @@ -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] diff --git a/server/modelpath_test.go b/server/modelpath_test.go index ef26266b..b6490221 100644 --- a/server/modelpath_test.go +++ b/server/modelpath_test.go @@ -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 {