From c592551a377666ece87b6197693e7d6ce2b6fb43 Mon Sep 17 00:00:00 2001 From: Adam Martin <42001113+amartin120@users.noreply.github.com> Date: Tue, 13 Aug 2024 15:18:10 -0400 Subject: [PATCH] fix image ref keys getting squashed when containing sigs/atts (#291) * fix image ref keys getting squashed when containing sigs/atts Signed-off-by: Adam Martin --------- Signed-off-by: Adam Martin Signed-off-by: Adam Martin Co-authored-by: Adam Martin --- pkg/content/oci.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/content/oci.go b/pkg/content/oci.go index 313af028..5aa1396b 100644 --- a/pkg/content/oci.go +++ b/pkg/content/oci.go @@ -55,9 +55,9 @@ func (o *OCI) AddIndex(desc ocispec.Descriptor) error { if strings.TrimSpace(key.String()) != "--" { switch key.(type) { case name.Digest: - o.nameMap.Store(key.Context().String(), desc) + o.nameMap.Store(fmt.Sprintf("%s-%s", key.Context().String(), desc.Annotations[consts.KindAnnotationName]), desc) case name.Tag: - o.nameMap.Store(key.String(), desc) + o.nameMap.Store(fmt.Sprintf("%s-%s", key.String(), desc.Annotations[consts.KindAnnotationName]), desc) } } return o.SaveIndex() @@ -93,9 +93,9 @@ func (o *OCI) LoadIndex() error { if strings.TrimSpace(key.String()) != "--" { switch key.(type) { case name.Digest: - o.nameMap.Store(key.Context().String(), desc) + o.nameMap.Store(fmt.Sprintf("%s-%s", key.Context().String(), desc.Annotations[consts.KindAnnotationName]), desc) case name.Tag: - o.nameMap.Store(key.String(), desc) + o.nameMap.Store(fmt.Sprintf("%s-%s", key.String(), desc.Annotations[consts.KindAnnotationName]), desc) } } }