From 8d65267b32b2f4e782f6cae04647271d2d0e0c50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Thu, 12 Aug 2021 08:07:18 +0200 Subject: [PATCH] Return proper watcher if SharedStorage originates from ExternalMount MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- apps/files_sharing/lib/SharedStorage.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/files_sharing/lib/SharedStorage.php b/apps/files_sharing/lib/SharedStorage.php index f4a525ce871d3..aa6e9d0b4204f 100644 --- a/apps/files_sharing/lib/SharedStorage.php +++ b/apps/files_sharing/lib/SharedStorage.php @@ -34,10 +34,14 @@ use OC\Files\Cache\FailedCache; use OC\Files\Cache\NullWatcher; +use OC\Files\Cache\Watcher; use OC\Files\Filesystem; use OC\Files\Storage\FailedStorage; use OC\Files\Storage\Wrapper\PermissionsMask; use OC\User\NoUserException; +use OCA\Files_External\Config\ExternalMountPoint; +use OCA\Files_External\Service\GlobalStoragesService; +use OCA\Files_External\Service\StoragesService; use OCP\Constants; use OCP\Files\Cache\ICacheEntry; use OCP\Files\NotFoundException; @@ -405,7 +409,14 @@ public function getOwner($path): string { return $this->superShare->getShareOwner(); } - public function getWatcher($path = '', $storage = null): NullWatcher { + public function getWatcher($path = '', $storage = null): Watcher { + // If the share is originating from an external storage + $mountManager = \OC::$server->getMountManager(); + $storageId = $this->getShare()->getNodeCacheEntry()->getStorageId(); + $mount = $mountManager->findByNumericId($storageId)[0]; + if ($mount instanceof ExternalMountPoint) { + return parent::getWatcher($path, $storage); + } // cache updating is handled by the share source return new NullWatcher(); }