diff options
author | Git'Fellow <12234510+solracsf@users.noreply.github.com> | 2023-11-17 00:00:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-17 00:00:51 +0100 |
commit | ed8293f5a8509edeed89d564a5614eae99c91172 (patch) | |
tree | 35a3d46c72dc1d96500297c711fb60fc2509cd43 /apps | |
parent | d9f88634f6fbaa83d9a0218eb31d4f909261ab8a (diff) | |
parent | 07c0223863bff0a1f29a3b5c80b018bc84bd1924 (diff) | |
download | nextcloud-server-ed8293f5a8509edeed89d564a5614eae99c91172.tar.gz nextcloud-server-ed8293f5a8509edeed89d564a5614eae99c91172.zip |
Merge pull request #41553 from nextcloud/backport/41518/stable27
[stable27] fix(files_versions): don't call getUid() on null
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_versions/lib/Listener/FileEventsListener.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/files_versions/lib/Listener/FileEventsListener.php b/apps/files_versions/lib/Listener/FileEventsListener.php index d90283bacc8..323b92b3920 100644 --- a/apps/files_versions/lib/Listener/FileEventsListener.php +++ b/apps/files_versions/lib/Listener/FileEventsListener.php @@ -351,7 +351,7 @@ class FileEventsListener implements IEventListener { /** * Retrieve the path relative to the current user root folder. - * If no user is connected, use the node's owner. + * If no user is connected, try to use the node's owner. */ private function getPathForNode(Node $node): ?string { try { @@ -359,8 +359,12 @@ class FileEventsListener implements IEventListener { ->getUserFolder(\OC_User::getUser()) ->getRelativePath($node->getPath()); } catch (\Throwable $ex) { + $owner = $node->getOwner(); + if ($owner === null) { + return null; + } return $this->rootFolder - ->getUserFolder($node->getOwner()->getUid()) + ->getUserFolder($owner->getUid()) ->getRelativePath($node->getPath()); } } |