diff --git a/pkg/content/oci.go b/pkg/content/oci.go index 57c56ef17..626802325 100644 --- a/pkg/content/oci.go +++ b/pkg/content/oci.go @@ -98,6 +98,8 @@ func (s *OCIStore) AddReference(name string, desc ocispec.Descriptor) { } if _, ok := s.nameMap[name]; ok { + s.nameMap[name] = desc + for i, ref := range s.index.Manifests { if name == ref.Annotations[ocispec.AnnotationRefName] { s.index.Manifests[i] = desc @@ -107,11 +109,12 @@ func (s *OCIStore) AddReference(name string, desc ocispec.Descriptor) { // Process should not reach here. // Fallthrough to `Add` scenario and recover. + s.index.Manifests = append(s.index.Manifests, desc) + return } s.index.Manifests = append(s.index.Manifests, desc) s.nameMap[name] = desc - return } // DeleteReference deletes an reference from index.