Merge pull request #3670 from imeoer/fix-panic-on-cache

fix a possible panic on cache
This commit is contained in:
Justin Chadwell
2023-02-24 12:07:01 +00:00
committed by GitHub

6
cache/remote.go vendored
View File

@@ -228,13 +228,13 @@ func (sr *immutableRef) getRemote(ctx context.Context, createIfNeeded bool, refC
newDesc.Size = blobDesc.Size
newDesc.URLs = blobDesc.URLs
newDesc.Annotations = nil
if len(addAnnotations) > 0 || len(blobDesc.Annotations) > 0 {
newDesc.Annotations = make(map[string]string)
}
for _, k := range addAnnotations {
newDesc.Annotations[k] = desc.Annotations[k]
}
for k, v := range blobDesc.Annotations {
if newDesc.Annotations == nil {
newDesc.Annotations = make(map[string]string)
}
newDesc.Annotations[k] = v
}
desc = newDesc