ipfs / specs

Technical specifications for the IPFS protocol stack
https://specs.ipfs.tech
1.15k stars 232 forks source link

Create IPIP: UnixFS and Gateway support for explicit MIME/Content-Type #364

Open lidel opened 1 year ago

lidel commented 1 year ago

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 and mtime, 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 https://github.com/ipfs/specs/issues/257

Context

UnixFSv2 never happened, but ability to explicitly specify Content-Type was one of my asks: https://github.com/ipld/legacy-unixfs-v2/issues/11

Years 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 and mtime attributes. ~2020 (https://github.com/ipfs/specs/issues/217#issuecomment-582369839). Support for mode and mtime was implemented in JS-IPFS a while ago, Kubo still has PR open (https://github.com/ipfs/go-unixfs/pull/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 https://github.com/ipfs/specs/issues/257.

Ref.

TODO

lidel commented 1 year ago

Need some help with historical context:

Feels like there is a reason why Metadata was not used for mtime and mode (see js-ipfs-unixfs/unixfs.proto)

@achingbrain @alanshaw do you remember why these fields landed in Data and not Metadata? Or who would be good person to ask?