From 71c2456e3a9677043509916c1ea53548f3b4e67e Mon Sep 17 00:00:00 2001 From: =?utf8?q?John=20Molakvo=C3=A6?= Date: Fri, 10 Sep 2021 15:27:37 +0200 Subject: [PATCH] Return proper watcher if SharedStorage originates from ExternalMount --- apps/files_sharing/lib/SharedStorage.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/apps/files_sharing/lib/SharedStorage.php b/apps/files_sharing/lib/SharedStorage.php index fe09102e8f6..d9f5a036b01 100644 --- a/apps/files_sharing/lib/SharedStorage.php +++ b/apps/files_sharing/lib/SharedStorage.php @@ -402,7 +402,20 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto return $this->superShare->getShareOwner(); } - public function getWatcher($path = '', $storage = null) { + public function getWatcher($path = '', $storage = null): Watcher { + $mountManager = \OC::$server->getMountManager(); + + // Get node informations + $node = $this->getShare()->getNodeCacheEntry(); + if ($node) { + $mount = $mountManager->findByNumericId($node->getStorageId()); + // If the share is originating from an external storage + if (count($mount) > 0 && $mount[0] instanceof ExternalMountPoint) { + // Propagate original storage scan + return parent::getWatcher($path, $storage); + } + } + // cache updating is handled by the share source return new NullWatcher(); } -- 2.39.5