Skip to content

Commit

Permalink
Merge pull request #49614 from nextcloud/backport/49569/stable29
Browse files Browse the repository at this point in the history
  • Loading branch information
provokateurin authored Jan 9, 2025
2 parents 359dc62 + 11a3593 commit a9d1d34
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions apps/files_sharing/lib/SharedStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
namespace OCA\Files_Sharing;

use OC\Files\Cache\CacheDependencies;
use OC\Files\Cache\CacheEntry;
use OC\Files\Cache\FailedCache;
use OC\Files\Cache\NullWatcher;
use OC\Files\Cache\Watcher;
Expand All @@ -43,14 +44,11 @@
use OC\Files\Storage\Wrapper\PermissionsMask;
use OC\Files\Storage\Wrapper\Wrapper;
use OC\User\NoUserException;
use OCA\Files_External\Config\ConfigAdapter;
use OCP\Constants;
use OCP\Files\Cache\ICacheEntry;
use OCP\Files\Config\IUserMountCache;
use OCP\Files\Folder;
use OCP\Files\IHomeStorage;
use OCP\Files\IRootFolder;
use OCP\Files\Node;
use OCP\Files\NotFoundException;
use OCP\Files\Storage\IDisableEncryptionStorage;
use OCP\Files\Storage\IStorage;
Expand Down Expand Up @@ -481,17 +479,13 @@ public function getWatcher($path = '', $storage = null): Watcher {

// Get node information
$node = $this->getShare()->getNodeCacheEntry();
if ($node) {
/** @var IUserMountCache $userMountCache */
$userMountCache = \OC::$server->get(IUserMountCache::class);
$mounts = $userMountCache->getMountsForStorageId($node->getStorageId());
foreach ($mounts as $mount) {
// If the share is originating from an external storage
if ($mount->getMountProvider() === ConfigAdapter::class) {
// Propagate original storage scan
$this->watcher = parent::getWatcher($path, $storage);
return $this->watcher;
}
if ($node instanceof CacheEntry) {
$storageId = $node->getData()['storage_string_id'];
// for shares from the home storage we can rely on the home storage to keep itself up to date
// for other storages we need use the proper watcher
if (!(str_starts_with($storageId, 'home::') || str_starts_with($storageId, 'object::user'))) {
$this->watcher = parent::getWatcher($path, $storage);
return $this->watcher;
}
}

Expand Down

0 comments on commit a9d1d34

Please sign in to comment.