Skip to content

cache: update media type metadata when linking blob with matching digest - #7320

Closed
AdamMagued wants to merge 1 commit into
moby:masterfrom
AdamMagued:fix-issue-7308-blob-mediatype-variant
Closed

AdamMagued wants to merge 1 commit into
moby:masterfrom
AdamMagued:fix-issue-7308-blob-mediatype-variant

Conversation

@AdamMagued

Copy link
Copy Markdown

Update ref media type metadata when linking a converted blob with an identical digest.

When a layer was already compressed with the target algorithm (such as zstd) but labeled with a different media type (such as gzip), layer conversion produces a descriptor with the same digest but updated media type. linkBlob previously returned early without updating the ref's media type metadata, and walkBlobVariantsOnly skipped matching digests, causing getBlobWithCompression to fail with ErrNotFound.

Updated linkBlob to queue the updated media type when desc.Digest == blobDigest, and updated walkBlob to inspect the content store descriptor if its media type differs from the ref descriptor.

Fixes #7308

Signed-off-by: AdamMagued <adamismailmageud@gmail.com>
@crazy-max

Copy link
Copy Markdown
Member

I'm closing this PR for the same account-activity concerns described in #7319.

This change has a plausible technical basis, but it proceeds without resolving the scope question already raised on the linked issue. @tonistiigi questioned whether BuildKit should repair malformed image metadata, and the reporter agreed that the root bug belongs in Moby, suggesting clearer diagnostics as an acceptable BuildKit improvement: #7308 (comment) and #7308 (comment). Automatically correcting the metadata needs agreement on that behavior before implementation.

If I've misread the situation, please contact us through the community Slack. I'm open to correcting my judgment.

@crazy-max crazy-max closed this Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

force-compression=true fails with "failed to get compression blob" on zstd layers labelled gzip

2 participants