Skip to content
This repository was archived by the owner on Dec 6, 2022. It is now read-only.
This repository was archived by the owner on Dec 6, 2022. It is now read-only.

Storing Explicit Content Type #11

@lidel

Description

@lidel

For some reason I was under impression unixfs-v2 has an option to set explicit content-type (aka mime/media-type) that travels along with data, but I did not found any discussion (cc #1 #10) about it.

My working assumption is that one could store it as one of optional "Extended Attributes", as noted in #2.

Is this assumption correct?
If not, what is the current line of thought when it comes to media types and IPFS?

Digression On Ambiguous Bytes

Depending on assumed content-type, the meaning and presentation of specific types of data may change drastically, breaking UX assumption made by the original author.

There are other examples floating around, but a poster child for storing explicit content-type for some types of content is SVG (image/svg+xml).
It produced issues every now and then by being mime-sniffed incorrectly:

I am working on custom protocol handler in web browsers, and noticed edge cases where it would be really beneficial to have an option to provide own media type with media itself and avoid media type sniffing, be it userland javascript or the browser itself. Same goes for HTTP gateway in go-ipfs: it could take advantage of additional media type metadata (if present) and set proper Content-Type header without relying on net/http/sniff.go. There are security contexts in which it makes sense to set X-Content-Type-Options: nosniff and AFAIK right now we don't have any good answer for that. Supporting media type as optional value in unixfs-v2 could be a viable one.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions