Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion storage/storage_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,10 @@ func (s *storageImageDestination) HasBlob(ctx context.Context, blobinfo types.Bl
if err != nil && errors.Cause(err) != storage.ErrLayerUnknown {
return false, -1, errors.Wrapf(err, `Error looking for compressed layers with digest %q`, blobinfo.Digest)
}
if len(layers) > 0 {
// If we got a match, check the compressed digest: if it is not equal, we have a layer which matches the searched
// one only after decompression (this can happen only due to a bug in earlier c/storage versions).
// So, the CompressedSize value may not match blob info.Digest, and we can’t use it.
if len(layers) > 0 && blobinfo.Digest == layers[0].CompressedDigest {
// Record the uncompressed value so that we can use it to calculate layer IDs.
s.blobDiffIDs[blobinfo.Digest] = layers[0].UncompressedDigest
return true, layers[0].CompressedSize, nil
Expand Down