Open Markdown as view-only. Do not overwrite file.

  • Nextcloud Server version (e.g., 29.x.x):
    • 33.0.3
  • Operating system and version (e.g., Ubuntu 24.04):
    • OpenSUSE Leap 16.0
  • Web server and version (e.g, Apache 2.4.25):
    • Nginx
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • Nginx
  • PHP version (e.g, 8.3):
    • n/a
  • Is this the first time you’ve seen this error? (Yes / No):
    • No
  • When did this problem seem to first start?
    • n/a
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • Bare metal
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • No

Summary of the issue you are facing:

Markdown files keep being mangled by the Nextcloud frontend, even when not opened for edit.

The Nextcloud frontend should not overwrite files unless they are physically edited by the user. This is especially the case when open_read_only_enabled is used.

An open_force_read_only or similar setting would be appreciated, to allow viewing rendered Markdown files on the frontend but not editing them, which is very easy to do accidentally.

Steps to replicate it (hint: details matter!):

  1. Setup a Nextcloud instance
  2. Set occ config:app:set text open_read_only_enabled --value=1 – this will ensure the Markdown files are opened in “view” mode, not with the editor
  3. Setup Nextcloud desktop client sync
  4. Create a Markdown file on the desktop, write some content into it (tables are best to see the mangling)
  5. Let the file sync to the cloud
  6. Open the Nextcloud web frontend
  7. Navigate to the directory where the Markdown file sits
  8. Open the Markdown file (it will open in view mode)
  9. Wait for a few seconds
  10. Note how the file on your desktop has changed (look at the timestamp, diff with a copy, or keep it open on kwrite or kate). The web frontend may or may not show a message to the effect that there is a “file conflict”, even though you never touched a comma in the file itself – the frontend appears to rewrite Markdown files on its own initiative the moment they are opened, even for viewing.

Log entries

Nextcloud

n/a

Web Browser

n/a

Web server / Reverse Proxy

n/a

Configuration

Nextcloud

The output of occ config:list system

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "memcache.local": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "auth.bruteforce.protection.enabled": false,
        "version": "33.0.3.2",
        "logtimezone": "UTC",
        "installed": true,
        "mail_smtpmode": "smtp",
        "maintenance": false,
        "theme": "",
        "loglevel": 3,
        "appstore.experimental.enabled": false,
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauth": 1,
        "mail_smtpauthtype": "LOGIN",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpdebug": false,
        "updater.release.channel": "stable",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "simpleSignUpLink.shown": false,
        "app_install_overwrite": [
            "calendar",
            "tasks",
            "files_readmemd",
        ],
        "mail_sendmailmode": "smtp",
        "mail_smtpsecure": "ssl",
        "maintenance_window_start": 1,
        "default_locale": "en_GB",
        "skeletondirectory": "",
        "templatedirectory": "",
        "user_oidc": {
            "oidc_provider_bearer_validation": true
        }
    }
}

I found a similar issue where someone appears to claim that Nextcloud should support the expected behaviour post version 31:

This does not appear to be the case, though, unless there is some configuration setting that I am not aware of?

Sorry for bumping but am I really the only user that expects a README to be rendered as a README just like every other application does? That is to say, without going into some automatic edit mode, going into a conflict with itself, presenting a casual user two equally confusing choices about which version to keep, then creating a random “Conflicted copy” file on the desktop client anyway, etc?

There was a README application that did the job fantastically well, but sadly it is no longer supported on the newer nextcloud versions.

NB: There appears to be a new option! :backhand_index_pointing_down:

Sadly the table rendering needs improvement at this time, but the author seems aware of that. I shall keep an eye on this one. :eyes:

I would be interested to know how many people use the collaborative editing thing that the built-in README viewer seems to want to do versus actually viewing Markdown files rendered as HTML.