Skip to content

Allow setting files media type with podman artifact add #25884

Closed
@l0rd

Description

@l0rd

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:

Suggest potential solution

To address these cases, podman artifact add should have a flag to specify the files' media types.

Metadata

Metadata

Assignees

Labels

kind/featureCategorizes issue or PR as related to a new feature.triagedIssue has been triaged

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions