nextcloud / android

📱 Nextcloud Android app
https://play.google.com/store/apps/details?id=com.nextcloud.client
GNU General Public License v2.0
4.21k stars 1.75k forks source link

Matlab source files not opened as text files #2081

Closed zingmars closed 5 years ago

zingmars commented 6 years ago

Actual behaviour

When opening a file with a .m extension (Matlab source file), the app downloads it and prompts you to open with apps that don't even deal with text files - https://i.imgur.com/tXdv7PA.jpg.

Perhaps consider adding "Open As" button the same way the Total Commander app does (it lets you open files as if they were a text file/image/video/music no matter what the extension or mime type is, in case the app doesn't recognise it properly)?

Expected behaviour

Either it should open as a text file, or it should let you to open it with an app that supports text files

Steps to reproduce

  1. Have a .m file on NextCloud
  2. Try to open it with the Android app

Environment data

Android version: 8.0.0

Device model: OnePlus 3

Stock or customized system: Stock

Nextcloud app version: 2.0.0

Nextcloud server version: v13.0.0b4

AndyScherzinger commented 6 years ago

@jancborchardt @MorrisJobke @tobiasKaminsky @mario What do you think? The Android app implements the Nextcloud servers mime type detection 1:1, so since the server doesn't know of .m neither does the Android client. So we could implement the mechanism described in the issue leaving the decision about the mime type to the user in case we can't/don't detect it but this would then of course add yet another menu entry to the file item menu.

jancborchardt commented 6 years ago

If we know that something doesn't work as expected, we shouldn't leave it up to every single user to manage it. :)

Meaning: We should add the .m mimetype to the server, and have it open as textfile (if no Matlab program is installed) as that seems the expected way. No extra menu entry.

zingmars commented 6 years ago

From how I see it, cataloguing every single major extension is going to be a fairly major task though, not to mention that the user might have files that he has himself created with arbitrary file extensions. You wouldn't be making the users to manage, you would be giving them the option to do so if they desire it.

jancborchardt commented 6 years ago

We’re not building Nextcloud to give people settings/options, we’re building it to offer solutions.

And if adding certain extensions manually is necessary for that then so be it. You did have the feedback, and that’s how we properly solve it. :)

AndyScherzinger commented 6 years ago

@jancborchardt would in your opinion this solution also apply for nextcloud/server#2073?

jancborchardt commented 6 years ago

@AndyScherzinger I guess it does, no? As you say in that thread:

an we basically would need to have a mime type detection for .love file extension to map to application/x-love-game

So yeah, we do have to do what feels like strange handcoding for specific filetypes. But if that helps make the experience for those as expected, it’s the proper solution.

Spartachetto commented 6 years ago

The problem with the various file formats happens also in the web interface.

It was reported both for the text editor: Manage the file extensions associated with texteditor (by me...) and and for the server[enhancement] NC needs a mime type handler selector (by an app developer). If you read the text editor issues, several of them are about adding various file formats...

I wonder if a unified solution could be possible...

Spartachetto commented 6 years ago

@AndyScherzinger I have the impression that this is a duplicate of nextcloud/server#1756.

That issue made you open another issue in the server repository: Recognize further file extensions as text files (to be opened in the "in-app" text editor).

AndyScherzinger commented 6 years ago

@Spartachetto to some extend yes but relying on the server's mimeType detection hasn't been implemented yet and also the servers mimeType detection would have to be extended to recognize Matlab files since that would be yet another extension.

Spartachetto commented 6 years ago

@AndyScherzinger Thank for your answer!

I got "interested" in mimeType detection because I wanted to open with the text editor files with a .R extension (R language files ).

Do you think that I have to open another issue here in the android app repository, or better to ask in the server repository? I'm missing the details of what you decided in this issue... 🙂

AndyScherzinger commented 6 years ago

Hi @Spartachetto,

no need for another issue :) I haven't decided anything since this is a group effort/project. @tobiasKaminsky @mario any opinion? I agree with @jancborchardt to simply extend the mimeType mapping (for now) and maybe do a more general solution later as described by Tobias.

tobiasKaminsky commented 6 years ago

If we want to have .r files open in our own text preview, then we of course have to implement it. The other issue about .love (#2073) can maybe/hopefully solved in a different way.

AndyScherzinger commented 6 years ago

@tobiasKaminsky any ideas? I tried to implement a mapping but with the actual implementation the mimetype of the OCFile is used which is application/octet-stream and thus it is treated as "file" and not as text since it doesn't check for file extension mappings. Meanwhile the webUI on Nc13 detects this file as text and opens the text editor. So I am not sure why this works for web but not for the Android client.