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:
-
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
-
Add a custom MIME mapping in case there is no mapping available yet.
-
Delete a custom MIME mapping (for example when an app gets uninstalled)
-
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.
Some apps need additional MIME types which are not known in Nextcloud yet.
Examples:
Keeweb:
x-application/kdbxfor the extension.kdbx(see jhass/nextcloud-keeweb#34)Drawio:
application/x-drawiofor 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 theconfig/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:
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
Add a custom MIME mapping in case there is no mapping available yet.
Delete a custom MIME mapping (for example when an app gets uninstalled)
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.