nextcloud / recommendations

🎁 Shows recommended files in Nextcloud
GNU Affero General Public License v3.0
16 stars 18 forks source link

Registered MIME types are ignored #340

Open arnowelzel opened 3 years ago

arnowelzel commented 3 years ago

Some apps register their own MIME types or act as a handler to open certain file types. For example Draw.io can be configured to open XML files or you can add ".drawio" as custom MIME type in /config/mimetypemapping.json (also see https://github.com/pawelrojek/nextcloud-drawio).

Within the file manager this works fine - when clicking an XML file (.xml) or a file with the extension .drawio Draw.io will start and open the file.

However - when I try the same with a file which is on top of the file list as "recommendation" or with an entry in the "recommendet files" box in the dashboard, XML files are always handled as text file and .drawio as unknown type, so only the file manager is opened with the file selected.

What is missing to make this work? Is this a bug in the recommendations app?

ChristophWurst commented 3 years ago

Hmmm. See https://github.com/nextcloud/recommendations/blob/master/src/components/RecommendedFile.vue. We use the OC.MimeType.getIconUrl function to get the previews and OCA.Viewer.mimetypes to check for possible handling in the Viewer.

I don't know how open with custom mime handlers is done in other places. Can you enlighten me?

NanoSector commented 2 years ago

I can reproduce this still in the case of Drawio. Opening the file from the Files recommendations bar takes you to the file as normal, opening it from the Dashboard navigates to it and then downloads it.

Since this app uses the /f/fileid link in case it cannot navigate directly in the Files app (e.g. dashboard), this might be a Nextcloud core/Files app/Drawio app issue instead of this app? It would be interesting to see if this can be reproduced with other apps as well.