From 5705d174373b0be5472aff630ac03353d56635b1 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 8 Sep 2025 18:21:54 +0200 Subject: [PATCH] fix: ignore root mount when getting mount for node Signed-off-by: Robin Appelman --- lib/Operation.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/Operation.php b/lib/Operation.php index b8ab90af..c5ea8c7d 100644 --- a/lib/Operation.php +++ b/lib/Operation.php @@ -18,7 +18,6 @@ use OCP\Files\ForbiddenException; use OCP\Files\IRootFolder; use OCP\Files\Mount\IMountManager; -use OCP\Files\Mount\IMountPoint; use OCP\Files\Node; use OCP\Files\NotFoundException; use OCP\Files\Storage\IStorage; @@ -266,8 +265,16 @@ public function onEvent(string $eventName, Event $event, IRuleMatcher $ruleMatch * @param array|ICacheEntry|null $cacheEntry */ private function getNode(IStorage $storage, string $path, $cacheEntry = null): ?Node { - /** @var IMountPoint|false $mountPoint */ - $mountPoint = current($this->mountManager->findByStorageId($storage->getId())); + $mountPoint = null; + $mounts = $this->mountManager->findByStorageId($storage->getId()); + foreach ($mounts as $mount) { + // we don't want to root mount; + if (strlen($mount->getMountPoint()) > 2) { + $mountPoint = $mount; + break; + } + } + if (!$mountPoint) { return null; }