Skip to content

Commit 18672bf

Browse files
solracsfbackportbot[bot]
authored andcommitted
fix(SharedStorage): Check if storage ID is set on cache
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com> [skip ci]
1 parent 8bf22d9 commit 18672bf

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

apps/files_sharing/lib/SharedStorage.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
use OCP\Files\Storage\IDisableEncryptionStorage;
5454
use OCP\Files\Storage\IStorage;
5555
use OCP\Lock\ILockingProvider;
56+
use OCP\Server;
5657
use OCP\Share\IShare;
5758
use Psr\Log\LoggerInterface;
5859

@@ -166,7 +167,7 @@ private function init() {
166167
}
167168

168169
/** @var IRootFolder $rootFolder */
169-
$rootFolder = \OC::$server->get(IRootFolder::class);
170+
$rootFolder = Server::get(IRootFolder::class);
170171
$this->ownerUserFolder = $rootFolder->getUserFolder($this->superShare->getShareOwner());
171172
$sourceId = $this->superShare->getNodeId();
172173
$ownerNodes = $this->ownerUserFolder->getById($sourceId);
@@ -455,7 +456,7 @@ public function getCache($path = '', $storage = null) {
455456
$this->cache = new \OCA\Files_Sharing\Cache(
456457
$storage,
457458
$sourceRoot,
458-
\OC::$server->get(CacheDependencies::class),
459+
Server::get(CacheDependencies::class),
459460
$this->getShare()
460461
);
461462
return $this->cache;
@@ -480,7 +481,7 @@ public function getWatcher($path = '', $storage = null): Watcher {
480481
// Get node information
481482
$node = $this->getShare()->getNodeCacheEntry();
482483
if ($node instanceof CacheEntry) {
483-
$storageId = $node->getData()['storage_string_id'];
484+
$storageId = $node->getData()['storage_string_id'] ?? null;
484485
// for shares from the home storage we can rely on the home storage to keep itself up to date
485486
// for other storages we need use the proper watcher
486487
if (!(str_starts_with($storageId, 'home::') || str_starts_with($storageId, 'object::user'))) {

0 commit comments

Comments
 (0)