Closed
Description
Feature request description
The media type of artifacts files is derived from the first 512 bytes of the file using go standard library net/http#DetectContentType.
The media type can be incorrect and a source of error when the artifact gets pushed to an OCI container image registry.
Consider the following example:
# run Zot (https://zotregistry.dev) on localhost:5001
podman run -d -p "127.0.0.1:5001:5000" --name zot ghcr.io/project-zot/zot-minimal-linux-amd64:latest
# create hello.yaml and an artifact hello:latest
echo "foo: bar" > hello.yaml
podman artifact add localhost:5001/hello/hello:latest ./hello.yaml
# verify that the layer's media type is `text/plain; charset=utf-8`
podman artifact inspect localhost:5001/hello/hello:latest | jq '.Manifest.layers[].mediaType'
# push it to Zot
podman artifact push docker://localhost:5001/hello/hello:latest
Pushing the artifact returns an error:
Error: invalid reference format
The media type inferred by DetectContentType
(text/plain; charset=utf-8
) is the issue:
- It includes the
charset
parameter and the support for media types parameters is controversial - It's not accurate (
text/yaml
would be more appropriate)
Suggest potential solution
To address these cases, podman artifact add
should have a flag to specify the files' media types.