Skip to content

Commit

Permalink
Merge pull request #2294 from mtrmac/layer-by-toc-sizing
Browse files Browse the repository at this point in the history
Fix manifest updates when we match a layer by TOC digest
  • Loading branch information
mtrmac committed Feb 15, 2024
2 parents bdfde4d + 80395a3 commit 36cc6a1
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions storage/storage_dest.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,12 +471,21 @@ func (s *storageImageDestination) tryReusingBlobAsPending(blobDigest digest.Dige
return false, private.ReusedBlob{}, fmt.Errorf(`looking for layers with TOC digest %q: %w`, options.TOCDigest, err)
}
if len(layers) > 0 {
s.lockProtected.indexToTOCDigest[*options.LayerIndex] = options.TOCDigest
return true, private.ReusedBlob{
Digest: blobDigest,
Size: layers[0].UncompressedSize,
MatchedByTOCDigest: true,
}, nil
if size != -1 {
s.lockProtected.indexToTOCDigest[*options.LayerIndex] = options.TOCDigest
return true, private.ReusedBlob{
Digest: blobDigest,
Size: size,
MatchedByTOCDigest: true,
}, nil
} else if options.CanSubstitute && layers[0].UncompressedDigest != "" {
s.lockProtected.indexToTOCDigest[*options.LayerIndex] = options.TOCDigest
return true, private.ReusedBlob{
Digest: layers[0].UncompressedDigest,
Size: layers[0].UncompressedSize,
MatchedByTOCDigest: true,
}, nil
}
}
}

Expand Down

0 comments on commit 36cc6a1

Please sign in to comment.