Skip to content

Commit

Permalink
Return proper watcher if SharedStorage originates from ExternalMount
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Sep 7, 2021
1 parent 74a1497 commit fe44de4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion apps/files_sharing/lib/SharedStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@

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 OCP\Constants;
use OCP\Files\Cache\ICacheEntry;
use OCP\Files\NotFoundException;
Expand Down Expand Up @@ -405,7 +407,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);
if (count($mount) > 0 && $mount[0] instanceof ExternalMountPoint) {
return parent::getWatcher($path, $storage);
}
// cache updating is handled by the share source
return new NullWatcher();
}
Expand Down

0 comments on commit fe44de4

Please sign in to comment.