oras attach
single file layer mediaType
could be inferred
#1651
Labels
oras attach
single file layer mediaType
could be inferred
#1651
What is the version of your ORAS CLI
1.2.2
What would you like to be added?
The
oras attach
docs do document how to set this with an explicit value, but given thehi.txt
example, would it not make more sense to infer the MIME type when one is not provided?Results may vary by tool, but if this were inferred by the ORAS CLI it'd be more consistent?
I know another Golang project Caddy leverages Go stdlib
mime
package for this which as the link notes will expand support when the host provides/etc/mime.types
. That doesn't infer MIME type by content, but by extension alone.A snippet for reference is:
The 2nd column is the extension to map to a MIME type. Those without one are just added for completeness (thus no associated extension recognized).
Additional mappings can be added, the extension can be compound (this can be seen with both
sarif.json
andspdx.json
), so for example adding in-toto attestation:For the most part though, it just seemed odd to default to assuming
application/vnd.oci.image.layer.v1.tar
? 😅Why is this needed for ORAS?
It may not always be accurate but it should be more often than assuming
application/vnd.oci.image.layer.v1.tar
?Uploading JSON for an in-toto attestation for example should be
application/vnd.in-toto+json
and that would need to be explicit.. but the default inference would still be a more accurate representation of the data:Are you willing to submit PRs to contribute to this feature?
The text was updated successfully, but these errors were encountered: