Skip to content

Show all text files #1756

Description

@fekir

Actual behaviour

The clients shows .txt and .md file with an internal editor.
AFAIK the client looks at the file extension before deciding how to open it.

Expected behaviour

All text (or at least a wider range of text files) files should be viewable from the client.

Steps to reproduce

  1. Create a file text with extension .adoc, .rc, .conf, .gitignore, .todo, .cfg, or without any extension
  2. Load the file on the nextcloud client
  3. On the android client tap on the new file

Environment data

Android version: 5.1.1

Device model:

Stock or customized system: Customized

Nextcloud app version: 2.0.1, from FDroid

Nextcloud server version: 12

I know that one cannot simply determine from the file extension if a file is a text file or not, maybe the best option would be to give the user the possibility to choose if the file extension/file type is not recognized.
On the other hand, I think that some formats, like .adoc for asciidoc, are only used for text files, it may be therefore safe to open them automatically with the internal editor, like for .md files.

Activity

  1. AndyScherzinger commented on Nov 7, 2017

    @AndyScherzinger
    Member

    It is perfectly fine to do it via the file extension, since we do it this way: https://github.com/nextcloud/android/blob/master/src/main/java/com/owncloud/android/utils/MimeTypeUtil.java#L478

    All the extensions you mention aren't mapped at this moment that is why they are treated as "file" which basically means no in-app logic.

    @tobiasKaminsky @mario @MorrisJobke what do you think? I am fine with adding these file extensions but would suggest that this should then be done consistently so that the server would also treat them as text files.

  2. MorrisJobke commented on Nov 7, 2017

    @MorrisJobke
    Member

    @tobiasKaminsky @mario @MorrisJobke what do you think? I am fine with adding these file extensions but would suggest that this should then be done consistently so that the server would also treat them as text files.

    In the server we have a list of allowed mime types: https://github.com/nextcloud/files_texteditor/blob/master/js/editor.js#L239-L249

    And we extend them with the markdown editor:

    https://github.com/icewind1991/files_markdown/blob/e47806d468ca5e153a22800a08063b4a3ddb1444/js/editor.ts#L8

  3. AndyScherzinger commented on Nov 7, 2017

    @AndyScherzinger
    Member

    @MorrisJobke but would the mapping https://github.com/nextcloud/server/blob/master/resources/config/mimetypemapping.dist.json be the first place as to even identify the mentioned extensions as text? So In order to have them recognized the mapping would have to be extended.

  4. MorrisJobke commented on Nov 7, 2017

    @MorrisJobke
    Member

    @MorrisJobke but would the mapping https://github.com/nextcloud/server/blob/master/resources/config/mimetypemapping.dist.json be the first place as to even identify the mentioned extensions as text? So In order to have them recognized the mapping would have to be extended.

    Yes - but I would say fixing the server also should be our first priority. If there is an issue with that we should address it in the server and not place another workaround ontop of it in the Android app (because this is then also needed in the web UI and iOS app)

  5. AndyScherzinger commented on Nov 7, 2017

    @AndyScherzinger
    Member

    Yes - but I would say fixing the server also should be our first priority.

    Absolutely agree with you. Does that imply with your code references that you would add support for the mentioned file extensions.

  6. MorrisJobke commented on Nov 7, 2017

    @MorrisJobke
    Member

    Absolutely agree with you. Does that imply with your code references that you would add support for the mentioned file extensions.

    Open a ticket in server and we can have a look.

  7. AndyScherzinger commented on Nov 7, 2017

    @AndyScherzinger
    Member

    @MorrisJobke created a referencing server issue nextcloud/server#7098

  8. fekir commented on Nov 7, 2017

    @fekir
    Author

    Another common text file type: .ini, and .sh
    I'm sure there are lot of other (nearly all "dotfiles" for example), thats why I said that maybe doing it by whitelisting all files extension might not be the best solution.

  9. joshtrichards commented on Aug 31, 2023

    @joshtrichards
    Member

    Implemented by #317 & #323

    Also see nextcloud/server#7098 for more extensive context.

    Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementneeds infoWaiting for info from user(s). Issues with this label will auto-stale.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions