API: Handle Blob Media Types Consistently
Context
Blob media types are not being handled in a consistent manner across the application, both in the API and the importer. Blobs media types are likely not absolute, but rather change in related to their associated manifests. Therefore, we should only use application/octet-stream
for blobs in the blobs
table, and we should always use the media type recorded in the manifest JSON in the layers
table.
API
We associate blobs and manifests here, we pull the blob object, populating it with data from the blobs
table. This will always be application/octet-stream
since we don't seed the media type during blob upload here as attested to by ancient hieroglyphs original authors. The blobwritter fills in application/octet-stream
here.
However, as I mentioned before, we should not populate the media type here. There's nothing that would prevent two manifests, even the same repository, from referencing the same blob but considering the media type to be different. We should instead always store as application/octet-stream
in the database for common blobs storage in the blobs
table, using the layers
table to set manifest-specific media types.
Configuration blob media types are stored directly on the manifest, and we use the media type present in the manifest JSON in this case.