-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recognize further file extensions as text files (to be opened in the "in-app" text editor) #7098
Comments
@icewind1991 @rullzer Ideas for this? |
Wouldn't be possible to automatically identify the file type based on its mime-type instead of pinning it to file extensions? It was a common trick in the past to fake a file extension to bypass email block list etc. |
The fileinfo command is used as fallback, because it is usually a lot slower and the file needs to be loaded into memory for this. Thus it is not that performant if you need to detect the mime type for a lot of files in a batch. But for uploads this should be fine. On the other side it is then bad to use one approach for file uploads but another one for files:scan. 😕 cc @icewind1991 |
@MorrisJobke Thank you for the explanation. I agree, for uploading single files it might be justified to spend that additional time to evaluate the correct mime-type but for batch runs it might be better to rely on the database information or a different approach need to be find. |
Besides that looking at the client we do not receive mime type information from the server that is why the clients also rely on the file extension to predict the mime type. |
@AndyScherzinger From what I've seen mime type information exist for all files on the server. Wouldn't it make sense to enhance the used API so that that piece of information is transferred too? |
@j-ed can't tell for the server part and yes having this info transferred from the server would help since we could (to some extend) drop mime-type calculation on the client(s) afaik the mime type information (at least via file extension) is the same on webUI and Android client. So if the webUI thinks a file is text-based than the Android client should do so too (if file extension based of course). |
We do get the mimetype: From RemoteFile to OCFile: Were do we rely on the file extension? Maybe only on local files? |
We always do for Android, see |
Then we should adapt this: use mimeType from server as often as possible and rely on the extension only as fallback. |
Sounds good to me for Android 👍 @nextcloud/ios how is this handled in the iOS client? |
I use the UTI, but if possible the mimeType from server is better ! |
I hope not to derail the discussion but, as you are considering to extend the files recognized as some that could be open via text editor, I'd like to remember the proposal of other extensions. Look here (nextcloud/files_texteditor#16) and here (nextcloud/files_texteditor#15) for different syntax files which could be nice to open. Thank you |
I'm closing this issue due to inactivity. Please reopen if you still want to implement this. |
I was at least able to open .conf files with the built in text editor. So I think this is at least partially implemented. |
Also on Android with built in text editor? |
Yes |
Tough I wonder why this is in the server repository if it is an android ticket? 🤔 |
@szaimen this issue pops out several times in seemingly unrelated subjects. |
This is a clone of nextcloud/android#1756 which asked for further file extensions to be opened in the Android client's in-app viewer. So for consistency reasons if this is to be implemented it should be implemented across the eco system as-in webUI and clients (at least Android and iOS)
Expected behaviour
Actual behaviour
.adoc, .rc, .conf, .gitignore, .todo, .cfg are treated as generic file
Environment data
Android version: 5.1.1
Stock or customized device OS: Customized
Nextcloud Android app version: 2.0.1, from FDroid
Nextcloud server version: 12
The text was updated successfully, but these errors were encountered: