Create IPIP: UnixFS and Gateway support for explicit MIME/Content-Type #364
Labels
need/triage
Needs initial labeling and prioritization
P1
High: Likely tackled by core team if no one steps up
This is a placeholder issue for creating IPIP to add support for storing explicit MIME/Content-Type in UnixFS DAG itself, like we already do for opt-in
mode
andmtime
, and acting on its presence on Gateways.There is alrernative approach to allow stating explicit content-type header via
_headers
file (similar to recently shipped_redirects
) – some notes in #257Context
UnixFSv2 never happened, but ability to explicitly specify
Content-Type
was one of my asks: ipld/legacy-unixfs-v2#11Years later, we still guess
Content-Type
on gateways.While it is fine for most of the time, but we should provide users with ability to explicitly set media type at the time of data onboarding.
Since 2018 we made some related development: we've added opt-in support for
mode
andmtime
attributes. ~2020 (#217 (comment)). Support formode
andmtime
was implemented in JS-IPFS a while ago, Kubo still has PR open (ipfs/go-unixfs#117).Initial idea (details to be fleshed out in IPIP) is to introduce optional
mtype
similar way.This is alternative to introducing
_headers
file mentioned in #257.Ref.
Content-Type
: Content Type set by HTTP Gateway in-web-browsers#152Content-Type
based on filename and magic bytes: https://github.com/ipfs/kubo/blob/v0.17.0-rc2/core/corehttp/gateway_handler_unixfs_file.go#L55-L87/ipfs/cid
is requested without any filename, but with built-in support for explicit content type we could make it "just work".TODO
Content-Type
header--content-type
toipfs add
Content-Type
header on gateway, if presentThe text was updated successfully, but these errors were encountered: