Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument #2 ($path) must be of type string, null given #3169

Closed
SystemKeeper opened this issue Sep 8, 2023 · 10 comments
Closed

Argument #2 ($path) must be of type string, null given #3169

SystemKeeper opened this issue Sep 8, 2023 · 10 comments
Labels
bug Something isn't working

Comments

@SystemKeeper
Copy link

Describe the bug
When opening a file via the iOS Files app on an iPad and edit something, I am unable to save the changes. When closing the document and opening it again it's still the old state.

To Reproduce
Steps to reproduce the behavior:

  1. Open file on iOS Files
  2. Edit something
  3. Save

Please note: The file that was tried to edit is on a groupfolder and was then shared to a user (not sure if relevant). So
User1 -> Groupfolder1 -> File1
User1 shares File1 to User2
User2 tries to edit File1

Expected behavior
The changes should be saved, but they're not (or not always? not sure). Log see below.
When I tested it again, it worked. But I can see the exception regularly in my log.

Screenshots
If applicable, add screenshots to help explain your problem.

Client details:

  • OS: iPad OS 16.6
  • Browser iOS Files app (so Mobile Safari I guess)
  • Device: iPad Pro 12.9

Server details

Operating system: Debian 11.7

Web server: Apache

Database: MySQL

PHP version: 8.2.8

Nextcloud version: 27.1.0 RC 1

Version of the richdocuments app 8.1.1

Version of Collabora Online Coolwsd version details: 23.05.3.1 - a719c0f - id 176fd4c0 - on Debian GNU/Linux 12 (bookworm)

Logs

Nextcloud log (data/nextcloud.log)

{
  "Exception": "Exception",
  "Message": "OC\\Files\\View::basicOperation(): Argument #2 ($path) must be of type string, null given, called in /var/www/nextcloud/lib/private/Files/View.php on line 518 in file '/var/www/nextcloud/lib/private/Files/View.php' line 1118",
  "Code": 0,
  "Trace": [
    {
      "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
      "line": 183,
      "function": "dispatch",
      "class": "OC\\AppFramework\\Http\\Dispatcher",
      "type": "->"
    },
    {
      "file": "/var/www/nextcloud/lib/private/Route/Router.php",
      "line": 315,
      "function": "main",
      "class": "OC\\AppFramework\\App",
      "type": "::"
    },
    {
      "file": "/var/www/nextcloud/lib/base.php",
      "line": 1071,
      "function": "match",
      "class": "OC\\Route\\Router",
      "type": "->"
    },
    {
      "file": "/var/www/nextcloud/index.php",
      "line": 36,
      "function": "handleRequest",
      "class": "OC",
      "type": "::"
    }
  ],
  "File": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
  "Line": 169,
  "Previous": {
    "Exception": "TypeError",
    "Message": "OC\\Files\\View::basicOperation(): Argument #2 ($path) must be of type string, null given, called in /var/www/nextcloud/lib/private/Files/View.php on line 518",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/lib/private/Files/View.php",
        "line": 518,
        "function": "basicOperation",
        "class": "OC\\Files\\View",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Filesystem.php",
        "line": 545,
        "function": "file_exists",
        "class": "OC\\Files\\View",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/files_versions/lib/Storage.php",
        "line": 189,
        "function": "file_exists",
        "class": "OC\\Files\\Filesystem",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/apps/files_versions/lib/Listener/FileEventsListener.php",
        "line": 210,
        "function": "store",
        "class": "OCA\\Files_Versions\\Storage",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/apps/files_versions/lib/Listener/FileEventsListener.php",
        "line": 107,
        "function": "write_hook",
        "class": "OCA\\Files_Versions\\Listener\\FileEventsListener",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/EventDispatcher/ServiceEventListener.php",
        "line": 86,
        "function": "handle",
        "class": "OCA\\Files_Versions\\Listener\\FileEventsListener",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
        "line": 251,
        "function": "__invoke",
        "class": "OC\\EventDispatcher\\ServiceEventListener",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
        "line": 73,
        "function": "callListeners",
        "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/EventDispatcher/EventDispatcher.php",
        "line": 94,
        "function": "dispatch",
        "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/EventDispatcher/EventDispatcher.php",
        "line": 106,
        "function": "dispatch",
        "class": "OC\\EventDispatcher\\EventDispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Node/HookConnector.php",
        "line": 112,
        "function": "dispatchTyped",
        "class": "OC\\EventDispatcher\\EventDispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/legacy/OC_Hook.php",
        "line": 105,
        "function": "write",
        "class": "OC\\Files\\Node\\HookConnector",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/View.php",
        "line": 586,
        "function": "emit",
        "class": "OC_Hook",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/View.php",
        "line": 629,
        "function": "emit_file_hooks_pre",
        "class": "OC\\Files\\View",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Node/File.php",
        "line": 73,
        "function": "file_put_contents",
        "class": "OC\\Files\\View",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
        "line": 504,
        "function": "putContent",
        "class": "OC\\Files\\Node\\File",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
        "line": 786,
        "function": "OCA\\Richdocuments\\Controller\\{closure}",
        "class": "OCA\\Richdocuments\\Controller\\WopiController",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
        "line": 763,
        "function": "retryOperation",
        "class": "OCA\\Richdocuments\\Controller\\WopiController",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Lock/LockManager.php",
        "line": 39,
        "function": "OCA\\Richdocuments\\Controller\\{closure}",
        "class": "OCA\\Richdocuments\\Controller\\WopiController",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
        "line": 766,
        "function": "runInScope",
        "class": "OC\\Files\\Lock\\LockManager",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
        "line": 503,
        "function": "wrappedFilesystemOperation",
        "class": "OCA\\Richdocuments\\Controller\\WopiController",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 230,
        "function": "putFile",
        "class": "OCA\\Richdocuments\\Controller\\WopiController",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 137,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 183,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 315,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 1071,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/index.php",
        "line": 36,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/nextcloud/lib/private/Files/View.php",
    "Line": 1118
  }

Collabora log

wsd-00001-01352 2023-09-08 07:09:08.998918 +0000 [ docbroker_03f ] ERR  Unexpected response to WOPI::PutFile. Cannot upload file to WOPI storage uri [https://<...>/index.php/apps/richdocuments/wopi/files/847474_oc4r8rpp6vq8/contents?access_token=<...>&access_token_ttl=1694192312000&permission=edit]: 500 (Internal Server Error) Internal Server Error:  .....

wsd-00001-01352 2023-09-08 07:09:08.999299 +0000 [ docbroker_03f ] ERR  Failed to upload docKey [https%3A%2F%2F<....>%3A443%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2F847474_oc4r8rpp6vq8] to URI [https://<...>/index.php/apps/richdocuments/wopi/files/847474_oc4r8rpp6vq8?access_token=<...>&access_token_ttl=1694192312000&permission=edit]. Notifying client.| wsd/DocumentBroker.cpp:2045

wsd-00001-01352 2023-09-08 07:09:12.476455 +0000 [ docbroker_03f ] ERR  Failed to store the document and reached maximum retry count of 5. Giving up. The document should be recoverable from the quarantine. Save failures: 0, Upload failures: 7| wsd/DocumentBroker.cpp:436

@juliusknorr
Copy link
Member

The trace doesn't look too specific to richdocuments. It looks a bit like https://github.com/nextcloud/server/blob/cec0b310a5af84d5afae4afa2449840dcdca56be/apps/files_versions/lib/Listener/FileEventsListener.php#L202 is called with an empty path for some reason.

@juliusknorr
Copy link
Member

Wondering if nextcloud/groupfolders#2543 might be related/needed for 27.1

@SystemKeeper
Copy link
Author

The trace doesn't look too specific to richdocuments.

Hm, right, I didn't even notice that.
I did take a look at older logs and also found the same error in 27.0.2.1. So I guess it's not related to the PR mentioned above?!

{
  "Exception": "Exception",
  "Message": "OC\\Files\\View::basicOperation(): Argument #2 ($path) must be of type string, null given, called in /var/www/nextcloud/lib/private/Files/View.php on line 518 in file '/var/www/nextcloud/lib/private/Files/View.php' line 1110",
  "Code": 0,
  "Trace": [
    {
      "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
      "line": 183,
      "function": "dispatch",
      "class": "OC\\AppFramework\\Http\\Dispatcher",
      "type": "->"
    },
    {
      "file": "/var/www/nextcloud/lib/private/Route/Router.php",
      "line": 315,
      "function": "main",
      "class": "OC\\AppFramework\\App",
      "type": "::"
    },
    {
      "file": "/var/www/nextcloud/lib/base.php",
      "line": 1071,
      "function": "match",
      "class": "OC\\Route\\Router",
      "type": "->"
    },
    {
      "file": "/var/www/nextcloud/index.php",
      "line": 36,
      "function": "handleRequest",
      "class": "OC",
      "type": "::"
    }
  ],
  "File": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
  "Line": 169,
  "Previous": {
    "Exception": "TypeError",
    "Message": "OC\\Files\\View::basicOperation(): Argument #2 ($path) must be of type string, null given, called in /var/www/nextcloud/lib/private/Files/View.php on line 518",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/lib/private/Files/View.php",
        "line": 518,
        "function": "basicOperation",
        "class": "OC\\Files\\View",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Filesystem.php",
        "line": 545,
        "function": "file_exists",
        "class": "OC\\Files\\View",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/files_versions/lib/Storage.php",
        "line": 189,
        "function": "file_exists",
        "class": "OC\\Files\\Filesystem",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/apps/files_versions/lib/Listener/FileEventsListener.php",
        "line": 210,
        "function": "store",
        "class": "OCA\\Files_Versions\\Storage",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/apps/files_versions/lib/Listener/FileEventsListener.php",
        "line": 107,
        "function": "write_hook",
        "class": "OCA\\Files_Versions\\Listener\\FileEventsListener",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/EventDispatcher/ServiceEventListener.php",
        "line": 86,
        "function": "handle",
        "class": "OCA\\Files_Versions\\Listener\\FileEventsListener",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
        "line": 251,
        "function": "__invoke",
        "class": "OC\\EventDispatcher\\ServiceEventListener",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
        "line": 73,
        "function": "callListeners",
        "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/EventDispatcher/EventDispatcher.php",
        "line": 94,
        "function": "dispatch",
        "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/EventDispatcher/EventDispatcher.php",
        "line": 106,
        "function": "dispatch",
        "class": "OC\\EventDispatcher\\EventDispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Node/HookConnector.php",
        "line": 112,
        "function": "dispatchTyped",
        "class": "OC\\EventDispatcher\\EventDispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/legacy/OC_Hook.php",
        "line": 105,
        "function": "write",
        "class": "OC\\Files\\Node\\HookConnector",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/View.php",
        "line": 586,
        "function": "emit",
        "class": "OC_Hook",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/View.php",
        "line": 629,
        "function": "emit_file_hooks_pre",
        "class": "OC\\Files\\View",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Node/File.php",
        "line": 73,
        "function": "file_put_contents",
        "class": "OC\\Files\\View",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
        "line": 504,
        "function": "putContent",
        "class": "OC\\Files\\Node\\File",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
        "line": 786,
        "function": "OCA\\Richdocuments\\Controller\\{closure}",
        "class": "OCA\\Richdocuments\\Controller\\WopiController",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
        "line": 763,
        "function": "retryOperation",
        "class": "OCA\\Richdocuments\\Controller\\WopiController",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Lock/LockManager.php",
        "line": 39,
        "function": "OCA\\Richdocuments\\Controller\\{closure}",
        "class": "OCA\\Richdocuments\\Controller\\WopiController",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
        "line": 766,
        "function": "runInScope",
        "class": "OC\\Files\\Lock\\LockManager",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/richdocuments/lib/Controller/WopiController.php",
        "line": 503,
        "function": "wrappedFilesystemOperation",
        "class": "OCA\\Richdocuments\\Controller\\WopiController",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 230,
        "function": "putFile",
        "class": "OCA\\Richdocuments\\Controller\\WopiController",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 137,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 183,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 315,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 1071,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/index.php",
        "line": 36,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/nextcloud/lib/private/Files/View.php",
    "Line": 1110
  }

@SystemKeeper
Copy link
Author

Ah, just found a server issue about this, sounds like the same problem: nextcloud/server#40090

@jolly-jump
Copy link

Hi.
We found the same problem using
a.) Android NC-App or iOS NC-app trying to save a collabora-document
b.) NC 27.1.1 (in docker) + NC-Office 8.2.0, collabora/code:23.05.4.2.1 (in docker), NC-AndroidApp v3.25.0
c.) no groupfolder app
d.) the user is trying to edit a file inside a shared folder which he/she is not allow to create/delete documents in.

does this help to track it down?
I do get five log-messages corresponding to five tries by collabora.
The collabora log says:

office                | wsd-00010-53877 2023-10-05 20:58:49.851467 +0000 [ docbroker_352 ] ERR  Failed to upload docKey [https%3A%2F%2Fcloud.xxxxxxxx%3A443%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2F4525979_oc5ejzyaxyvh] to URI [https://cloud.xxxxxxxxxxxxxx/index.php/apps/richdocuments/wopi/files/4525979_oc5ejzyaxyvh?access_token=24Lye5KB0IUUQdGMTNu0GaFkRIJ6gimc&access_token_ttl=1696575335000]. Notifying client.| wsd/DocumentBroker.cpp:2045
office                | wsd-00010-53877 2023-10-05 20:58:49.851585 +0000 [ docbroker_352 ] ERR  Failed to store the document and reached maximum retry count of 5. Giving up. The document should be recoverable from the quarantine. Save failures: 0, Upload failures: 5| wsd/DocumentBroker.cpp:436

@jolly-jump
Copy link

The trace doesn't look too specific to richdocuments. It looks a bit like https://github.com/nextcloud/server/blob/cec0b310a5af84d5afae4afa2449840dcdca56be/apps/files_versions/lib/Listener/FileEventsListener.php#L202 is called with an empty path for some reason.

Hi @juliushaertl
I can verify this now: Here: nextcloud/server#40090 (comment) I have reproduced that the mobile editing of a file shared with me is differently handled than the webediting of the same shared file by me.

In the mobile-editing case, the $path is "null", since the $node is the $node of the file-owner. Thus the truncation to a relativepath fails, since /alice/files/i_own_this/file.odt does not compare to /bob/file/file.odt. I am not sure, if the $node object is the wrong one or that is the way richdocuments does it in the mobileediting case.

In the web-editing case, everything works out. the $node is the $node of the editor, not the file-owner.

@joshtrichards joshtrichards added the bug Something isn't working label Nov 10, 2023
@joshtrichards
Copy link
Member

This looks like #2896.

@jakobroehrl
Copy link

When I disable the version app, the problem is solved for me.
The version of the version app is 1.20.0
Is this solved in a newer version?

@SystemKeeper
Copy link
Author

Is this solved in a newer version?

I have disabled the files_version app since the error occurred, so not sure. From my gut feeling I would say "no", as otherwise this or the server issue would have been referenced, but of course it's always possible it was fixed as a side effect of some other change.

@jakobroehrl
Copy link

Fixed for me with the latest NC version, I actived the version App again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants