@@ -39,13 +39,13 @@ func ParseDockerImage(imageName string) (*DockerImageInfo, error) {
3939 }
4040 }
4141
42- parts := strings .Split (imageName , "/" )
42+ parts := strings .SplitN (imageName , "/" , 2 )
4343 if len (parts ) < 2 {
4444 return nil , fmt .Errorf ("invalid docker image format: '%s'" , imageName )
4545 }
4646
4747 info .Registry = parts [0 ]
48- repo , image := parseRegistryAndExtract (info .Registry , parts [1 : ])
48+ repo , image := parseRegistryAndExtract (info .Registry , parts [1 ])
4949 info .Repo = repo
5050 info .Image = image
5151
@@ -55,8 +55,8 @@ func ParseDockerImage(imageName string) (*DockerImageInfo, error) {
5555 return info , nil
5656}
5757
58- func parseRegistryAndExtract (registry string , remainingParts [] string ) (repo , image string ) {
59- image = strings . Join ( remainingParts , "/" )
58+ func parseRegistryAndExtract (registry string , remaining string ) (repo , image string ) {
59+ image = remaining
6060
6161 // SaaS subdomain: <INSTANCE>-<REPO>.jfrog.io/image:tag (repo in subdomain, check first)
6262 if matches := jfrogSubdomainPattern .FindStringSubmatch (registry ); len (matches ) > 2 {
@@ -71,10 +71,9 @@ func parseRegistryAndExtract(registry string, remainingParts []string) (repo, im
7171 return
7272 }
7373
74- // Repository path: <REGISTRY>/<REPO>/image:tag (2+ parts means repo in path)
75- if len (remainingParts ) >= 2 {
76- repo = remainingParts [0 ]
77- image = strings .Join (remainingParts [1 :], "/" )
74+ // Repository path: <REGISTRY>/<REPO>/image:tag (repo in path if contains /)
75+ if strings .Contains (remaining , "/" ) {
76+ repo , image , _ = strings .Cut (remaining , "/" )
7877 return
7978 }
8079
0 commit comments