nextcloud / richdocuments

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

Editing anonymous shared files fails #3675

Closed morticah closed 6 months ago

morticah commented 6 months ago

Not always but more often than not the anonymous editing of documents fails with user message "Document can't be saved, check permissions"

I often share table documents via link so external people can edit it without needing an account on the server. I can't pinpoint the date to any updates but since some days this doesn't work as expected anymore. Users can edit but in more than 50% of the time get the error "Document can't be saved, check permissions" on saving.

Problem is not browser dependent. I tested it on Chrome, Firefox, Brave, Safari.

Server runs Debian bookworm with nextcloud and collabora/code in docker and an Nginx as frontend webserver. Database is Mariadb.

Nextcloud Version is 29.0.0 richdocuments is 8.4.1 COOLWSD-Version: 24.04.1.4

occ config:

{
    "apps": {
        "richdocuments": {
            "canonical_webroot": "",
            "doc_format": "ooxml",
            "enabled": "yes",
            "external_apps": "",
            "installed_version": "8.4.1",
            "public_wopi_url": "https:\/\/<MYHOST>",
            "types": "prevent_group_restriction",
            "wopi_allowlist": "",
            "wopi_url": "https:\/\/<MYHOST>"
        }
    }
}

Corresponding error in nextcloud:

{"reqId":"uXSE5wNA2cyCeRl1OGek","level":3,"time":"2024-05-08T10:46:37+00:00","remoteAddr":"172.17.0.4","user":"--","app":"richdocuments","method":"POST","url":"/index.php/apps/richdocuments/wopi/files/1900581_ockz3mch9dvi/contents?access_token=VohTK00PZofJMTwD1zTXW4JEXpqZi6sC&access_token_ttl=0","message":"Uncaught error: No user found for the uid ","userAgent":"COOLWSD HTTP Agent 24.04.1.4","version":"29.0.0.19","exception":{"Exception":"InvalidArgumentException","Message":"No user found for the uid ","Code":0,"Trace":[{"file":"/var/www/html/custom_apps/richdocuments/lib/Controller/WopiController.php","line":427,"function":"setUserScope","class":"OCA\\Richdocuments\\Service\\UserScopeService","type":"->","args":[""]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":232,"function":"putFile","class":"OCA\\Richdocuments\\Controller\\WopiController","type":"->","args":["1900581","VohTK00PZofJMTwD1zTXW4JEXpqZi6sC"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":138,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Richdocuments\\Controller\\WopiController"],"putFile"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Richdocuments\\Controller\\WopiController"],"putFile"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":338,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Richdocuments\\Controller\\WopiController","putFile",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["1900581_ockz3mch9dvi","richdocuments.wopi.putfile"]]},{"file":"/var/www/html/lib/base.php","line":1050,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/richdocuments/wopi/files/1900581_ockz3mch9dvi/contents"]},{"file":"/var/www/html/index.php","line":49,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/custom_apps/richdocuments/lib/Service/UserScopeService.php","Line":51,"message":"Uncaught error: No user found for the uid ","exception":{},"CustomMessage":"Uncaught error: No user found for the uid "}}

Corresponding error in collabora:

Mai 08 12:46:37 pulsar docker[655931]: wsd-00001-00463 2024-05-08 12:46:37.187540 +0200 [ docbroker_017 ] ERR  Unexpected response to WOPI::PutFile. Cannot upload file to WOPI storage uri [https://<MYHOST>/index.php/apps/richdocuments/wopi/files/1900581_ockz3mch9dvi/contents?access_token=VohTK00PZofJMTwD1zTXW4JEXpqZi6sC&access_token_ttl=0]: 500 (Internal Server Error) Internal Server Error: {"message":"Error"}| wsd/wopi/WopiStorage.cpp:914
Mai 08 12:46:37 pulsar docker[655931]: wsd-00001-00463 2024-05-08 12:46:37.187591 +0200 [ docbroker_017 ] ERR  Failed to upload docKey [https%3A%2F%2F<MYHOST>%3A443%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2F1900581_ockz3mch9dvi] to URI [https://<MYHOST>/index.php/apps/richdocuments/wopi/files/1900581_ockz3mch9dvi?access_token=VohTK00PZofJMTwD1zTXW4JEXpqZi6sC&access_token_ttl=0]. Notifying client.| wsd/DocumentBroker.cpp:2227

As it looked to me to be a User-ID problem I searched the changes in richdocuments and found this: https://github.com/nextcloud/richdocuments/commit/4cb127a868e8b6e8edc3a39c1a5b78eb94c68916

I reverted this change in my installation and the problem seems to be gone.

juliusknorr commented 6 months ago

Thanks for reporting and already diving into the related parts a bit already. It seems interesting that this only is an issue sometimes. I managed to reproduce that and will check further