Skip to content

ImageStore: Preserve source index mediaType on push#750

Merged
jglogan merged 1 commit into
apple:mainfrom
tensorfields:preserve-source-index-mediatype
May 22, 2026
Merged

ImageStore: Preserve source index mediaType on push#750
jglogan merged 1 commit into
apple:mainfrom
tensorfields:preserve-source-index-mediatype

Conversation

@tensorfields
Copy link
Copy Markdown
Contributor

@tensorfields tensorfields commented May 22, 2026

Closes #749.

ExportOperation hardcoded the pushed index descriptor's mediaType to the OCI image index type. RegistryClient.push uses that descriptor's mediaType as the HTTP Content-Type header. When the source index was in Docker manifest.list.v2+json format (the common case for images pulled from Docker Hub and other public registries), the body's embedded mediaType field disagreed with the header, and OCI registries rejected the index PUT with HTTP 400 MANIFEST_INVALID.

Use the source index's mediaType for the pushed descriptor so the header always matches the body. Per-architecture child manifests are unaffected because they were already pushed with their actual mediaType.

Add a parameterized unit test for ExportOperation.export covering both Docker manifest.list

ExportOperation hardcoded the pushed index descriptor's mediaType to
the OCI image index type. RegistryClient.push uses that descriptor's
mediaType as the HTTP Content-Type header. When the source index was
in Docker manifest.list.v2+json format (the common case for images
pulled from Docker Hub and other public registries), the body's
embedded mediaType field disagreed with the header, and OCI registries
rejected the index PUT with HTTP 400 MANIFEST_INVALID.

Use the source index's mediaType for the pushed descriptor so the
header always matches the body. Per-architecture child manifests are
unaffected because they were already pushed with their actual
mediaType.

Add a parameterized unit test for ExportOperation.export covering both
Docker manifest.list
@tensorfields
Copy link
Copy Markdown
Contributor Author

This fixes #749

Copy link
Copy Markdown
Contributor

@jglogan jglogan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tensorfields Thanks for tracking down the cause and putting up a fix!

@jglogan jglogan merged commit 25558e6 into apple:main May 22, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: container image push fails for an image with an application/vnd.docker.distribution.manifest.list.v2+json index.

2 participants