diff --git a/pkg/ctl/implementation.go b/pkg/ctl/implementation.go index 999749a..fbccd78 100644 --- a/pkg/ctl/implementation.go +++ b/pkg/ctl/implementation.go @@ -551,7 +551,7 @@ func (impl *defaultVexCtlImplementation) NormalizeProducts(subjects []productRef ref := "" qs := p.Qualifiers.Map() if r, ok := qs["repository_url"]; ok { - ref = fmt.Sprintf("%s/%s", strings.TrimSuffix(r, "/"), p.Name) + ref = strings.TrimSuffix(r, "/") } else { // digest or image ref = p.Name diff --git a/pkg/ctl/implementation_test.go b/pkg/ctl/implementation_test.go index 9ae7b84..b1ea2c3 100644 --- a/pkg/ctl/implementation_test.go +++ b/pkg/ctl/implementation_test.go @@ -54,7 +54,7 @@ func TestNormalizeProducts(t *testing.T) { }, { name: "purl, custom registry", - products: []productRef{{Name: "pkg:oci/kube-apiserver?repository_url=registry.k8s.io&tag=v1.26.0"}}, + products: []productRef{{Name: "pkg:oci/kube-apiserver?repository_url=registry.k8s.io/kube-apiserver/&tag=v1.26.0"}}, expectedImage: []productRef{{Name: "registry.k8s.io/kube-apiserver:v1.26.0", Hashes: make(map[vex.Algorithm]vex.Hash)}}, expectedOther: []productRef{}, expectedUnattestable: []productRef{}, @@ -200,7 +200,7 @@ func TestVerifyImageSubjects(t *testing.T) { []intoto.Subject{ {Name: "ghcr.io/test/image@sha256:74634d9736a45ca9f6e1187e783492199e020f4a5c19d0b1abc2b604f894ac99"}, }, - []string{"pkg:oci/image@sha256:74634d9736a45ca9f6e1187e783492199e020f4a5c19d0b1abc2b604f894ac99?repository_url=ghcr.io/test"}, + []string{"pkg:oci/image@sha256:74634d9736a45ca9f6e1187e783492199e020f4a5c19d0b1abc2b604f894ac99?repository_url=ghcr.io/test/image"}, false, }, } {