nextcloud / richdocuments

📑 Collabora Online for Nextcloud
https://nextcloud.com/collaboraonline
355 stars 116 forks source link

Unable for an anonymous user to edit a file shared via Collabora: “The document could not be saved, please check your rights” on a document from an SMB share #3838

Closed supr4s closed 3 months ago

supr4s commented 3 months ago

Describe the bug

Hello everyone,

This problem suddenly appeared two weeks ago, although it's been running for almost a year without any problems. An anonymous user, with whom we have shared a file from an SMB network drive, can no longer modify a document via Collabora: “The document could not be saved, please check your rights”.

To Reproduce

Expected behavior

Ability to save recordings made by an anonymous user.

Server details

Operating system:

Debian 12

Web server:

Nginx 1.22

Database:

MySQL 5.8

PHP version:

PHP 8.2

Configuration of the richdocuments app

-> # sudo -u nextcloud php /srv/nextcloud/www/occ config:list richdocuments
{
    "apps": {
        "richdocuments": {
            "disable_certificate_verification": "",
            "doc_format": "",
            "edit_groups": "",
            "enabled": "yes",
            "external_apps": "",
            "installed_version": "8.4.3",
            "public_wopi_url": "https:\/\/collabora.cloud.xxx",
            "types": "prevent_group_restriction",
            "use_groups": "",
            "wopi_allowlist": "127.0.0.1,172.0.0.0\/8",
            "wopi_url": "https:\/\/collabora.cloud.xxx"
        }
    }
}

Nextcloud log (data/nextcloud.log)

I always get this message in the Nextcloud logs whenever the error message appears

{"reqId":"EynUgVuPy9F9v7UIziXX","level":3,"time":"2024-07-26T15:09:52+00:00","remoteAddr":"172.18.0.2","user":"6AFADC9D-85A0-439B-994C-CECBA518F572","app":"richdocuments","method":"POST","url":"/index.php/apps/richdocuments/wopi/files/1777845_oc9hn37k8m1e/contents?access_token=CTRyjn0SddbrxRhPZrdkayJQ2SCPdHN5&access_token_ttl=0","message":"Uncaught error: OC\\Files\\View::basicOperation(): Argument #2 ($path) must be of type string, null given, called in /srv/nextcloud/www/lib/private/Files/View.php on line 531 in file '/srv/nextcloud/www/lib/private/Files/View.php' line 1138","userAgent":"COOLWSD HTTP Agent 24.04.5.2","version":"29.0.4.1","exception":{"Exception":"Exception","Message":"OC\\Files\\View::basicOperation(): Argument #2 ($path) must be of type string, null given, called in /srv/nextcloud/www/lib/private/Files/View.php on line 531 in file '/srv/nextcloud/www/lib/private/Files/View.php' line 1138","Code":0,"Trace":[{"file":"/srv/nextcloud/www/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/srv/nextcloud/www/lib/private/Route/Router.php","line":338,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/srv/nextcloud/www/lib/base.php","line":1050,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/srv/nextcloud/www/index.php","line":49,"function":"handleRequest","class":"OC","type":"::"}],"File":"/srv/nextcloud/www/lib/private/AppFramework/Http/Dispatcher.php","Line":170,"Previous":{"Exception":"TypeError","Message":"OC\\Files\\View::basicOperation(): Argument #2 ($path) must be of type string, null given, called in /srv/nextcloud/www/lib/private/Files/View.php on line 531","Code":0,"Trace":[{"file":"/srv/nextcloud/www/lib/private/Files/View.php","line":531,"function":"basicOperation","class":"OC\\Files\\View","type":"->"},{"file":"/srv/nextcloud/www/lib/private/Files/Filesystem.php","line":546,"function":"file_exists","class":"OC\\Files\\View","type":"->"},{"file":"/srv/nextcloud/www/apps/files_versions/lib/Storage.php","line":190,"function":"file_exists","class":"OC\\Files\\Filesystem","type":"::"},{"file":"/srv/nextcloud/www/apps/files_versions/lib/Listener/FileEventsListener.php","line":197,"function":"store","class":"OCA\\Files_Versions\\Storage","type":"::"},{"file":"/srv/nextcloud/www/apps/files_versions/lib/Listener/FileEventsListener.php","line":103,"function":"write_hook","class":"OCA\\Files_Versions\\Listener\\FileEventsListener","type":"->"},{"file":"/srv/nextcloud/www/lib/private/EventDispatcher/ServiceEventListener.php","line":86,"function":"handle","class":"OCA\\Files_Versions\\Listener\\FileEventsListener","type":"->"},{"file":"/srv/nextcloud/www/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":230,"function":"__invoke","class":"OC\\EventDispatcher\\ServiceEventListener","type":"->"},{"file":"/srv/nextcloud/www/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":59,"function":"callListeners","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/srv/nextcloud/www/lib/private/EventDispatcher/EventDispatcher.php","line":86,"function":"dispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/srv/nextcloud/www/lib/private/EventDispatcher/EventDispatcher.php","line":98,"function":"dispatch","class":"OC\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/srv/nextcloud/www/lib/private/Files/Node/HookConnector.php","line":93,"function":"dispatchTyped","class":"OC\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/srv/nextcloud/www/lib/private/legacy/OC_Hook.php","line":105,"function":"write","class":"OC\\Files\\Node\\HookConnector","type":"->"},{"file":"/srv/nextcloud/www/lib/private/Files/View.php","line":599,"function":"emit","class":"OC_Hook","type":"::"},{"file":"/srv/nextcloud/www/lib/private/Files/View.php","line":642,"function":"emit_file_hooks_pre","class":"OC\\Files\\View","type":"->"},{"file":"/srv/nextcloud/www/lib/private/Files/Node/File.php","line":73,"function":"file_put_contents","class":"OC\\Files\\View","type":"->"},{"file":"/srv/nextcloud/www/apps/richdocuments/lib/Controller/WopiController.php","line":504,"function":"putContent","class":"OC\\Files\\Node\\File","type":"->"},{"file":"/srv/nextcloud/www/apps/richdocuments/lib/Controller/WopiController.php","line":796,"function":"OCA\\Richdocuments\\Controller\\{closure}","class":"OCA\\Richdocuments\\Controller\\WopiController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/srv/nextcloud/www/apps/richdocuments/lib/Controller/WopiController.php","line":773,"function":"retryOperation","class":"OCA\\Richdocuments\\Controller\\WopiController","type":"->"},{"file":"/srv/nextcloud/www/lib/private/Files/Lock/LockManager.php","line":29,"function":"OCA\\Richdocuments\\Controller\\{closure}","class":"OCA\\Richdocuments\\Controller\\WopiController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/srv/nextcloud/www/apps/richdocuments/lib/Controller/WopiController.php","line":776,"function":"runInScope","class":"OC\\Files\\Lock\\LockManager","type":"->"},{"file":"/srv/nextcloud/www/apps/richdocuments/lib/Controller/WopiController.php","line":503,"function":"wrappedFilesystemOperation","class":"OCA\\Richdocuments\\Controller\\WopiController","type":"->"},{"file":"/srv/nextcloud/www/lib/private/AppFramework/Http/Dispatcher.php","line":232,"function":"putFile","class":"OCA\\Richdocuments\\Controller\\WopiController","type":"->"},{"file":"/srv/nextcloud/www/lib/private/AppFramework/Http/Dispatcher.php","line":138,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/srv/nextcloud/www/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/srv/nextcloud/www/lib/private/Route/Router.php","line":338,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/srv/nextcloud/www/lib/base.php","line":1050,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/srv/nextcloud/www/index.php","line":49,"function":"handleRequest","class":"OC","type":"::"}],"File":"/srv/nextcloud/www/lib/private/Files/View.php","Line":1138},"message":"Uncaught error: OC\\Files\\View::basicOperation(): Argument #2 ($path) must be of type string, null given, called in /srv/nextcloud/www/lib/private/Files/View.php on line 531 in file '/srv/nextcloud/www/lib/private/Files/View.php' line 1138","exception":{},"CustomMessage":"Uncaught error: OC\\Files\\View::basicOperation(): Argument #2 ($path) must be of type string, null given, called in /srv/nextcloud/www/lib/private/Files/View.php on line 531 in file '/srv/nextcloud/www/lib/private/Files/View.php' line 1138"}}

And Collabora container :

wsd-00001-00084 2024-07-26 15:10:59.110436 +0000 [ docbroker_004 ] ERR  Unexpected response to WOPI::PutFile. Cannot upload file to WOPI storage uri [https://cloud.xxx/index.php/apps/richdocuments/wopi/files/1777845_oc9hn37k8m1e/contents?access_token=CTRyjn0SddbrxRhPZrdkayJQ2SCPdHN5&access_token_ttl=0]: 500 (Internal Server Error) Internal Server Error: {"message":"Error"}| wsd/wopi/WopiStorage.cpp:964
wsd-00001-00084 2024-07-26 15:10:59.110470 +0000 [ docbroker_004 ] ERR  Failed to upload docKey [https%3A%2F%2Fcloud.xxx%3A443%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2F1777845_oc9hn37k8m1e] to URI [https://cloud.xxx/index.php/apps/richdocuments/wopi/files/1777845_oc9hn37k8m1e?access_token=CTRyjn0SddbrxRhPZrdkayJQ2SCPdHN5&access_token_ttl=0]. Notifying client.| wsd/DocumentBroker.cpp:2350

Actions taken before opening the exit :

Interesting things:

If anyone has any ideas, I'll take it ..

juliusknorr commented 3 months ago

We had a recent fix for this in server, could you try the following patch to see if that solves it? https://github.com/nextcloud/server/pull/46679

supr4s commented 3 months ago

Hi @juliushaertl ,

I've applied the fix and can confirm that everything now works! Thanks a lot!