Skip to content

Create process for adding MIME-types to mapping. #2028

@lrhn

Description

@lrhn

This package has a big map of mappings from extensions to mime-types, and reverse.

There is no policy for updating this mapping, which leads to numerours requests for extensions to be added
(probably around half of: https://github.com/dart-lang/tools/issues?q=is%3Aissue%20state%3Aopen%20label%3Apackage%3Amime).

This package should do one of three things:

  • Decide on a source of truth for mappings (maybe some IETF standard if there is one), follow that, and have regular updates if the standard changes.
  • Don't rely on an outside source, and create a process for adding extensions to the map, or rejecting requests to add extensions, in a predictable and consistent way. Then all these issues can start using that process to get their extensions added.
  • Add a way for users to override/add to the default mapping. Preferably without mutating global state (I would suggest a Zone-based way to add or override mappings, which won't clobber other code doing the same thing.)

See #2027 for a request to simly make the mapping mutable. I would not go that way.

(For the third option, I'd probably make some kind of a MimeRegistry class that you can configure, and install as the default lookup for code that it runs in a zone. There are many ways to make it configurable, and I don't mind if it's mutable, as long as it's whoever creates it that ops in to that.)

@devoncarew

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