Skip to content

Commit 719480a

Browse files
committed
Return proper watcher if SharedStorage originates from ExternalMount
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
1 parent 74a1497 commit 719480a

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

apps/files_sharing/lib/SharedStorage.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@
3434

3535
use OC\Files\Cache\FailedCache;
3636
use OC\Files\Cache\NullWatcher;
37+
use OC\Files\Cache\Watcher;
3738
use OC\Files\Filesystem;
3839
use OC\Files\Storage\FailedStorage;
3940
use OC\Files\Storage\Wrapper\PermissionsMask;
4041
use OC\User\NoUserException;
42+
use OCA\Files_External\Config\ExternalMountPoint;
4143
use OCP\Constants;
4244
use OCP\Files\Cache\ICacheEntry;
4345
use OCP\Files\NotFoundException;
@@ -405,7 +407,20 @@ public function getOwner($path): string {
405407
return $this->superShare->getShareOwner();
406408
}
407409

408-
public function getWatcher($path = '', $storage = null): NullWatcher {
410+
public function getWatcher($path = '', $storage = null): Watcher {
411+
$mountManager = \OC::$server->getMountManager();
412+
413+
// Get node informations
414+
$node = $this->getShare()->getNodeCacheEntry();
415+
if ($node) {
416+
$mount = $mountManager->findByNumericId($node->getStorageId());
417+
// If the share is originating from an external storage
418+
if (count($mount) > 0 && $mount[0] instanceof ExternalMountPoint) {
419+
// Propagate original storage scan
420+
return parent::getWatcher($path, $storage);
421+
}
422+
}
423+
409424
// cache updating is handled by the share source
410425
return new NullWatcher();
411426
}

0 commit comments

Comments
 (0)