Skip to content

Commit cb55edf

Browse files
authored
Merge pull request #28786 from nextcloud/backport/28377/stable21
[stable21] Scan the shared external storage source on access
2 parents 2d1e0ae + 71c2456 commit cb55edf

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
@@ -35,10 +35,12 @@
3535

3636
use OC\Files\Cache\FailedCache;
3737
use OC\Files\Cache\NullWatcher;
38+
use OC\Files\Cache\Watcher;
3839
use OC\Files\Filesystem;
3940
use OC\Files\Storage\FailedStorage;
4041
use OC\Files\Storage\Wrapper\PermissionsMask;
4142
use OC\User\NoUserException;
43+
use OCA\Files_External\Config\ExternalMountPoint;
4244
use OCP\Constants;
4345
use OCP\Files\Cache\ICacheEntry;
4446
use OCP\Files\NotFoundException;
@@ -400,7 +402,20 @@ public function getOwner($path) {
400402
return $this->superShare->getShareOwner();
401403
}
402404

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

0 commit comments

Comments
 (0)