Skip to content

Commit

Permalink
Merge pull request containers#1778 from giuseppe/block-two-different-toc
Browse files Browse the repository at this point in the history
chunked: disallow both zstd:chunked and eStargz TOCs
  • Loading branch information
openshift-merge-bot[bot] authored Dec 15, 2023
2 parents 1a86024 + f435ce8 commit 72ed526
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/chunked/storage_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,17 @@ func GetDiffer(ctx context.Context, store storage.Store, blobSize int64, annotat
return nil, err
}

if _, ok := annotations[internal.ManifestChecksumKey]; ok {
_, hasZstdChunkedTOC := annotations[internal.ManifestChecksumKey]
_, hasEstargzTOC := annotations[estargz.TOCJSONDigestAnnotation]

if hasZstdChunkedTOC && hasEstargzTOC {
return nil, errors.New("both zstd:chunked and eStargz TOC found")
}

if hasZstdChunkedTOC {
return makeZstdChunkedDiffer(ctx, store, blobSize, annotations, iss, &storeOpts)
}
if _, ok := annotations[estargz.TOCJSONDigestAnnotation]; ok {
if hasEstargzTOC {
return makeEstargzChunkedDiffer(ctx, store, blobSize, annotations, iss, &storeOpts)
}

Expand Down

0 comments on commit 72ed526

Please sign in to comment.