nextcloud / files_lock

GNU Affero General Public License v3.0
24 stars 8 forks source link

Do not try to get the user folder if no user is set #69

Closed juliushaertl closed 1 year ago

juliushaertl commented 2 years ago

While the exception is handled the errors is still logged by the file system method

"exception": {
    "Exception": "OC\\User\\NoUserException",
    "Message": "Backends provided no user object",
    "Code": 0,
    "Trace": [
      {
        "function": "getUserFolder",
        "class": "OC\\Files\\Node\\Root",
        "type": "->"
      },
      {
        "file": "/var/www/html/lib/private/Files/Node/LazyFolder.php",
        "line": 72,
        "function": "call_user_func_array"
      },
      {
        "file": "/var/www/html/lib/private/Files/Node/LazyRoot.php",
        "line": 40,
        "function": "__call",
        "class": "OC\\Files\\Node\\LazyFolder",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/files_lock/lib/Service/FileService.php",
        "line": 128,
        "function": "getUserFolder",
        "class": "OC\\Files\\Node\\LazyRoot",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/files_lock/lib/DAV/LockBackend.php",
        "line": 150,
        "function": "getFileFromAbsoluteUri",
        "class": "OCA\\FilesLock\\Service\\FileService",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/files_lock/lib/DAV/LockBackend.php",
        "line": 75,
        "function": "getFileFromUri",
        "class": "OCA\\FilesLock\\DAV\\LockBackend",
        "type": "->"
      },
      {
        "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Locks/Plugin.php",
        "line": 141,
        "function": "getLocks",
        "class": "OCA\\FilesLock\\DAV\\LockBackend",
        "type": "->"
      },
      {
        "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Locks/Plugin.php",
        "line": 415,
        "function": "getLocks",
        "class": "Sabre\\DAV\\Locks\\Plugin",
        "type": "->"
      },
      {
        "file": "/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
        "line": 89,
        "function": "validateTokens",
        "class": "Sabre\\DAV\\Locks\\Plugin",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
        "line": 1448,
        "function": "emit",
        "class": "Sabre\\DAV\\Server",
        "type": "->"
      },
      {
        "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
        "line": 466,
        "function": "checkPreconditions",
        "class": "Sabre\\DAV\\Server",
        "type": "->"
      },
      {
        "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
        "line": 253,
        "function": "invokeMethod",
        "class": "Sabre\\DAV\\Server",
        "type": "->"
      },
      {
        "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
        "line": 321,
        "function": "start",
        "class": "Sabre\\DAV\\Server",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/dav/lib/Server.php",
        "line": 352,
        "function": "exec",
        "class": "Sabre\\DAV\\Server",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/dav/appinfo/v2/remote.php",
        "line": 35,
        "function": "exec",
        "class": "OCA\\DAV\\Server",
        "type": "->"
      },
      {
        "file": "/var/www/html/remote.php",
        "line": 166,
        "args": [
          "/var/www/html/apps/dav/appinfo/v2/remote.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/var/www/html/lib/private/Files/Node/Root.php",
    "Line": 368,
    "CustomMessage": "Backends provided no user object for users"
  }
juliushaertl commented 2 years ago

Happens on routes that do not match the /remote.php/dav/files/userid/... pattern, e.g. address books, which we should rather block then even earlier for locking.

juliushaertl commented 2 years ago

Another trace from public share links:

"exception": {
    "Exception": "Error",
    "Message": "Call to a member function getUID() on null",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/apps/files_lock/lib/DAV/LockBackend.php",
        "line": 153,
        "function": "getFileFromUri",
        "class": "OCA\\FilesLock\\Service\\FileService",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/files_lock/lib/DAV/LockBackend.php",
        "line": 75,
        "function": "getFileFromUri",
        "class": "OCA\\FilesLock\\DAV\\LockBackend",
        "type": "->"
      },
      {
        "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Locks/Plugin.php",
        "line": 141,
        "function": "getLocks",
        "class": "OCA\\FilesLock\\DAV\\LockBackend",
        "type": "->"
      },
      {
        "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Locks/Plugin.php",
        "line": 415,
        "function": "getLocks",
        "class": "Sabre\\DAV\\Locks\\Plugin",
        "type": "->"
      },
      {
        "file": "/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
        "line": 89,
        "function": "validateTokens",
        "class": "Sabre\\DAV\\Locks\\Plugin",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
        "line": 1448,
        "function": "emit",
        "class": "Sabre\\DAV\\Server",
        "type": "->"
      },
      {
        "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
        "line": 466,
        "function": "checkPreconditions",
        "class": "Sabre\\DAV\\Server",
        "type": "->"
      },
      {
        "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
        "line": 253,
        "function": "invokeMethod",
        "class": "Sabre\\DAV\\Server",
        "type": "->"
      },
      {
        "file": "/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php",
        "line": 321,
        "function": "start",
        "class": "Sabre\\DAV\\Server",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/dav/appinfo/v1/publicwebdav.php",
        "line": 113,
        "function": "exec",
        "class": "Sabre\\DAV\\Server",
        "type": "->"
      },
      {
        "file": "/var/www/html/public.php",
        "line": 80,
        "args": [
          "/var/www/html/apps/dav/appinfo/v1/publicwebdav.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/var/www/html/apps/files_lock/lib/Service/FileService.php",
    "Line": 109,
    "CustomMessage": "--"
  }
}
danir-de commented 2 years ago

We're affected by the issue: It results in not being able to create or move files on public link shares, so we had to disable the files_lock app temporarily, until the issue is resolved.