nextcloud / notes

✎ Distraction-free notes and writing
https://apps.nextcloud.com/apps/notes
GNU Affero General Public License v3.0
621 stars 134 forks source link

Rich Text Editing No Auto Save #1361

Open tunloop opened 2 months ago

tunloop commented 2 months ago

Steps to reproduce

  1. Enable notes rich text editing
  2. Type something
  3. Observe no auto save like traditional edit mode

Expected behaviour

Like in edit mode, the rich text edit mode should save a second or two after inactivity.

Actual behaviour

Rich Text editor mode has no auto save feature and requires manually saving each time

Logs

Log entry every time the edit tries to save:
{
  "reqId": "1bwjjYeH9WwzGQNiCVcl",
  "level": 3,
  "time": "2024-08-24T23:58:35+00:00",
  "remoteAddr": "192.168.0.2",
  "user": "admin1",
  "app": "text",
  "method": "PUT",
  "url": "/apps/text/session/12914/create",
  "message": "No permission to access this file",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:129.0) Gecko/20100101 Firefox/129.0",
  "version": "29.0.5.1",
  "exception": {
    "Exception": "OCP\\Files\\NotFoundException",
    "Message": "",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/apps/text/lib/Service/ApiService.php",
        "line": 92,
        "function": "getFileById",
        "class": "OCA\\Text\\Service\\DocumentService",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/text/lib/Controller/SessionController.php",
        "line": 62,
        "function": "create",
        "class": "OCA\\Text\\Service\\ApiService",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 232,
        "function": "create",
        "class": "OCA\\Text\\Controller\\SessionController",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 138,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 184,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 338,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 1053,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/index.php",
        "line": 49,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/nextcloud/apps/text/lib/Service/DocumentService.php",
    "Line": 514,
    "message": "No permission to access this file",
    "exception": [],
    "CustomMessage": "No permission to access this file"
  },
  "id": "66cad25acd457"
}
root@cloud:~$ ls -l /var/www/nextcloud/apps/text/lib/Service/DocumentService.php 
-rw-r--r-- 1 www-data www-data 22096 Aug 20 17:56 /var/www/nextcloud/apps/text/lib/Service/DocumentService.php
root@cloud:~$ ls -ld /var/www/nextcloud/apps/text/lib/Service/                    
drwxr-xr-x 2 www-data www-data 4096 Aug 22 16:15 /var/www/nextcloud/apps/text/lib/Service/
root@cloud:~$ ls -ld /var/www/nextcloud/apps/text/lib         
drwxr-xr-x 16 www-data www-data 4096 Aug 22 16:15 /var/www/nextcloud/apps/text/lib
root@cloud:~$ ls -ld /var/www/nextcloud/apps/text    
drwxr-xr-x 9 www-data www-data 4096 Aug 22 16:15 /var/www/nextcloud/apps/text
root@cloud:~$ ls -ld /var/www/nextcloud/apps     
drwxr-xr-x 65 www-data www-data 4096 Aug 23 18:30 /var/www/nextcloud/apps
root@cloud:~$ ls -ld /var/www/nextcloud     
drwxr-xr-x 14 www-data www-data 4096 Aug 22 16:15 /var/www/nextcloud
4 S root       80081       1  0  80   0 - 145893 do_epo Aug16 ?       00:00:35   php-fpm: master process (/etc/php/8.3/fpm/php-fpm.conf)
5 S www-data  147329   80081  0  80   0 - 170681 skb_wa Aug22 ?       00:02:33     php-fpm: pool www
5 S www-data  158782   80081  0  80   0 - 171344 skb_wa Aug23 ?       00:01:32     php-fpm: pool www
5 S www-data  171566   80081  0  80   0 - 171481 skb_wa 23:37 ?       00:00:04     php-fpm: pool www
5 S root      147295       1  0  80   0 -  5664 sigsus Aug22 ?        00:00:00   nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
5 S www-data  147296  147295  0  80   0 -  6359 do_epo Aug22 ?        00:00:22     nginx: worker process
5 S www-data  147297  147295  0  80   0 -  6266 do_epo Aug22 ?        00:00:21     nginx: worker process
5 S www-data  147298  147295  0  80   0 -  6229 do_epo Aug22 ?        00:00:21     nginx: worker process
5 S www-data  147299  147295  0  80   0 -  6164 do_epo Aug22 ?        00:00:21     nginx: worker process

Log says no permission to that php file. There is access to that file. Globally. And all directories above it.

Server

Please complete the following information.

Nextcloud configuration:

``` { "system": { "proxy": "apt.example.com:3142", "proxyexclude": [ "cloud.example.com", "sso.example.com" ], "instanceid": "***REMOVED SENSITIVE VALUE***", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "overwritehost": "cloud.example.com", "trusted_proxies": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "cloud.example.com:443" ], "connectivity_check_domains": [ "www.nextcloud.com" ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "dbtype": "mysql", "version": "29.0.5.1", "overwrite.cli.url": "https:\/\/cloud.example.com\/", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbtableprefix": "oc_", "mysql.utf8mb4": true, "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "installed": true, "maintenance": false, "maintenance_window_start": 1, "theme": "", "auth.webauthn.enabled": false, "loglevel": 2, "memcache.local": "\\OC\\Memcache\\APCu", "memcache.distributed": "\\OC\\Memcache\\Redis", "redis": { "host": "***REMOVED SENSITIVE VALUE***", "port": 0, "dbindex": 0, "timeout": 1.5 }, "memcache.locking": "\\OC\\Memcache\\Redis", "default_phone_region": "US", "allow_local_remote_servers": true, "mail_smtpmode": "sendmail", "mail_sendmailmode": "smtp", "mail_from_address": "***REMOVED SENSITIVE VALUE***", "mail_domain": "***REMOVED SENSITIVE VALUE***", "app_install_overwrite": [ "breezedark" ], "app.mail.verify-tls-peer": false, "memories.exiftool_no_local": true, "memories.vod.path": "\/var\/www\/nextcloud\/apps\/memories\/bin-ext\/go-vod-amd64" } } ```

Client

Please complete the following information.

joshtrichards commented 1 month ago

Log says no permission to that php file.

It's referring to the file being edited. The error comes from the rich text app:

https://github.com/nextcloud/text/blob/7a5e7c5c773a6fc7e8780f5d9ef3d46036886e29/lib/Service/ApiService.php#L69

Do you have similar behavior when editing a file outside of the Notes app? (E.g. directly creating or opening an md or txt file from Files)

joshtrichards commented 1 month ago

Also see: nextcloud/text#3899

tunloop commented 1 month ago

Log says no permission to that php file.

It's referring to the file being edited. The error comes from the rich text app:

https://github.com/nextcloud/text/blob/7a5e7c5c773a6fc7e8780f5d9ef3d46036886e29/lib/Service/ApiService.php#L69

Do you have similar behavior when editing a file outside of the Notes app? (E.g. directly creating or opening an md or txt file from Files)

I actually didn't know that editing in general has an autosave feature? Because, yeah, its the same error when editing files in the Documents app.

{
  "reqId": "HIQxW84rQlufb0qDHoAR",
  "level": 3,
  "time": "2024-09-10T17:48:55+00:00",
  "remoteAddr": "192.168.0.2",
  "user": "admin1",
  "app": "text",
  "method": "PUT",
  "url": "/apps/text/session/12914/create",
  "message": "No permission to access this file",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0",
  "version": "29.0.6.1",
  "exception": {
    "Exception": "OCP\\Files\\NotFoundException",
    "Message": "",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/apps/text/lib/Service/ApiService.php",
        "line": 92,
        "function": "getFileById",
        "class": "OCA\\Text\\Service\\DocumentService",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/text/lib/Controller/SessionController.php",
        "line": 62,
        "function": "create",
        "class": "OCA\\Text\\Service\\ApiService",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 232,
        "function": "create",
        "class": "OCA\\Text\\Controller\\SessionController",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 138,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 184,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 331,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 1058,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/index.php",
        "line": 49,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/nextcloud/apps/text/lib/Service/DocumentService.php",
    "Line": 514,
    "message": "No permission to access this file",
    "exception": [],
    "CustomMessage": "No permission to access this file"
  },
  "id": "66e086a726f3c"
}

But why would it not have access to the file Im trying to edit? Manually saving works. And I checked, the files are writable by the PHP user and group.

mejo- commented 1 month ago

@tunloop if I understand your report correctly, this is about the Notes app, right? Let me transfer the issue there then.

tunloop commented 1 month ago

@tunloop if I understand your report correctly, this is about the Notes app, right? Let me transfer the issue there then.

I actually don't know. This error happens in the documents section when editing text files in rich text mode, so this error would impact the rich text app in general and not only the notes app?

mariomorvan commented 1 month ago

I've also experienced auto-save issues on two different shared .md files edited from Nextcloud Notes. Today everything looked fine for more than 40mn editing, it's only after quitting and reopening the file, and looking at its edit history that I noticed none of the edits had been saved except the very first two. Hard to pin down exactly in which conditions this happens as autosaving often seems to work, but for what it is worth, those files are shared, and, in one case only, it was being collaboratively edited (again, with a pretty smooth editing experience all along, and the other editor's changes were perfectly well saved). I'm currently accessing Nextcloud 29.0.7.1 from Firefox 130.0.1.

Xyz00777 commented 4 days ago

Created a note yesterday evening about what to do today on my note phone app, directly changed into the rich text editor after creating it, made around 10 entrys and didn't touched the app for around a minute. I don't know anymore what I did after it but a moment ago I wanted to look and I had an empty note. That was not the first time, it's really annoying. Please fix

tunloop commented 4 days ago

I am still experiencing the same error as above with Nextcloud 30.0.1