Remove ChecksumAnntation from ZstdChunkedFooterData
Manage the value directly to simplify. This happens to fix the ReadFooterDataFromBlob code path, which was not setting ChecksumAnntation at all. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
parent
1f47b38c09
commit
053ac6105d
|
|
@ -145,7 +145,7 @@ func readZstdChunkedManifest(blobStream ImageSourceSeekable, blobSize int64, toc
|
|||
|
||||
if offsetMetadata := annotations[internal.ManifestInfoKey]; offsetMetadata != "" {
|
||||
var err error
|
||||
footerData, err = internal.ReadFooterDataFromAnnotations(tocDigest, annotations)
|
||||
footerData, err = internal.ReadFooterDataFromAnnotations(annotations)
|
||||
if err != nil {
|
||||
return nil, nil, 0, err
|
||||
}
|
||||
|
|
@ -233,7 +233,7 @@ func readZstdChunkedManifest(blobStream ImageSourceSeekable, blobSize int64, toc
|
|||
return nil, nil, 0, err
|
||||
}
|
||||
|
||||
decodedBlob, err := decodeAndValidateBlob(manifest, footerData.LengthUncompressed, footerData.ChecksumAnnotation)
|
||||
decodedBlob, err := decodeAndValidateBlob(manifest, footerData.LengthUncompressed, tocDigest.String())
|
||||
if err != nil {
|
||||
return nil, nil, 0, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -183,7 +183,6 @@ func WriteZstdChunkedManifest(dest io.Writer, outMetadata map[string]string, off
|
|||
Offset: manifestOffset,
|
||||
LengthCompressed: uint64(len(compressedManifest)),
|
||||
LengthUncompressed: uint64(len(manifest)),
|
||||
ChecksumAnnotation: "", // unused
|
||||
OffsetTarSplit: uint64(tarSplitOffset),
|
||||
LengthCompressedTarSplit: uint64(len(tarSplitData.Data)),
|
||||
LengthUncompressedTarSplit: uint64(tarSplitData.UncompressedSize),
|
||||
|
|
@ -207,7 +206,6 @@ type ZstdChunkedFooterData struct {
|
|||
Offset uint64
|
||||
LengthCompressed uint64
|
||||
LengthUncompressed uint64
|
||||
ChecksumAnnotation string // Only used when reading a layer, not when creating it
|
||||
|
||||
OffsetTarSplit uint64
|
||||
LengthCompressedTarSplit uint64
|
||||
|
|
@ -231,11 +229,9 @@ func footerDataToBlob(footer ZstdChunkedFooterData) []byte {
|
|||
}
|
||||
|
||||
// ReadFooterDataFromAnnotations reads the zstd:chunked footer data from the given annotations.
|
||||
func ReadFooterDataFromAnnotations(tocDigest digest.Digest, annotations map[string]string) (ZstdChunkedFooterData, error) {
|
||||
func ReadFooterDataFromAnnotations(annotations map[string]string) (ZstdChunkedFooterData, error) {
|
||||
var footerData ZstdChunkedFooterData
|
||||
|
||||
footerData.ChecksumAnnotation = tocDigest.String()
|
||||
|
||||
offsetMetadata := annotations[ManifestInfoKey]
|
||||
|
||||
if _, err := fmt.Sscanf(offsetMetadata, "%d:%d:%d:%d", &footerData.Offset, &footerData.LengthCompressed, &footerData.LengthUncompressed, &footerData.ManifestType); err != nil {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ func TestGenerateAndReadFooter(t *testing.T) {
|
|||
Offset: 2,
|
||||
LengthCompressed: 3,
|
||||
LengthUncompressed: 4,
|
||||
ChecksumAnnotation: "", // unused
|
||||
OffsetTarSplit: 5,
|
||||
LengthCompressedTarSplit: 6,
|
||||
LengthUncompressedTarSplit: 7,
|
||||
|
|
|
|||
Loading…
Reference in New Issue