Skip to content

Enhancement: API for apps to register their own MIME types and icons #10131

@arnowelzel

Description

@arnowelzel

Some apps need additional MIME types which are not known in Nextcloud yet.

Examples:

Keeweb: x-application/kdbx for the extension .kdbx (see jhass/nextcloud-keeweb#34)

Drawio: application/x-drawio for the extension .drawio(see pawelrojek/nextcloud-drawio#41)

Unfortunately, an app can not add its own MIME type mapping if needed. Instead the administrator has to extend the mapping in the Nextcloud configuration:

One has to copy /resources/config/mimetypemapping.dist.json to /config/mimetypemapping.json (in the config/ folder at Nextcloud’s root directory). Then you can add your own MIME type mapping according to the documentation of the app which needs it.

There are "hacks" which try to "emulate" this by modifiying the file cache (as described in jhass/nextcloud-keeweb#34) - but this is really just a hack and not a good solution.

So the better way would be an official API which provides the following functions:

  1. Check, if there is an existing MIME type mapping for a given extension and return the MIME type, so an app can use that to register itself as a handler for that type

  2. Add a custom MIME mapping in case there is no mapping available yet.

  3. Delete a custom MIME mapping (for example when an app gets uninstalled)

  4. Add custom icons for MIME types (and remove them when uninstalling the app) - in Draw.io the icons are set "on the fly" inside the file list, which is also more a crude hack than a proper solution. And the file details still show the original default icon and not the custom icon which Draw.io sets dynamically in the file list.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions