Skip to content

Commit

Permalink
Merge pull request #50769 from nextcloud/checkStorageIdSetCache
Browse files Browse the repository at this point in the history
fix(SharedStorage): Check if storage ID is set on cache
  • Loading branch information
ChristophWurst authored Feb 14, 2025
2 parents 20cedce + bc3be77 commit 228ac86
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions apps/files_sharing/lib/SharedStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,16 +438,15 @@ public function getWatcher(string $path = '', ?IStorage $storage = null): IWatch
// Get node information
$node = $this->getShare()->getNodeCacheEntry();
if ($node instanceof CacheEntry) {
$storageId = $node->getData()['storage_string_id'];
$storageId = $node->getData()['storage_string_id'] ?? null;
// 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'))) {
if ($storageId !== null && !(str_starts_with($storageId, 'home::') || str_starts_with($storageId, 'object::user'))) {
$cache = $this->getCache();
$this->watcher = parent::getWatcher($path, $storage);
if ($cache instanceof Cache) {
$this->watcher->onUpdate($cache->markRootChanged(...));
}

return $this->watcher;
}
}
Expand Down

0 comments on commit 228ac86

Please sign in to comment.