Skip to content

Commit 228ac86

Browse files
Merge pull request #50769 from nextcloud/checkStorageIdSetCache
fix(SharedStorage): Check if storage ID is set on cache
2 parents 20cedce + bc3be77 commit 228ac86

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

apps/files_sharing/lib/SharedStorage.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,16 +438,15 @@ public function getWatcher(string $path = '', ?IStorage $storage = null): IWatch
438438
// Get node information
439439
$node = $this->getShare()->getNodeCacheEntry();
440440
if ($node instanceof CacheEntry) {
441-
$storageId = $node->getData()['storage_string_id'];
441+
$storageId = $node->getData()['storage_string_id'] ?? null;
442442
// for shares from the home storage we can rely on the home storage to keep itself up to date
443443
// for other storages we need use the proper watcher
444-
if (!(str_starts_with($storageId, 'home::') || str_starts_with($storageId, 'object::user'))) {
444+
if ($storageId !== null && !(str_starts_with($storageId, 'home::') || str_starts_with($storageId, 'object::user'))) {
445445
$cache = $this->getCache();
446446
$this->watcher = parent::getWatcher($path, $storage);
447447
if ($cache instanceof Cache) {
448448
$this->watcher->onUpdate($cache->markRootChanged(...));
449449
}
450-
451450
return $this->watcher;
452451
}
453452
}

0 commit comments

Comments
 (0)