diff options
author | Git'Fellow <12234510+solracsf@users.noreply.github.com> | 2025-02-12 11:30:14 +0100 |
---|---|---|
committer | Git'Fellow <12234510+solracsf@users.noreply.github.com> | 2025-02-14 17:57:15 +0100 |
commit | 35377d7e97ee1a2e5b515fdfaf9e39da0dd25afe (patch) | |
tree | d9e46c17bcb11afde3f00aacafa0489452069140 | |
parent | 8bf22d939975d17b7258a570ffd933086e2a7caa (diff) | |
download | nextcloud-server-backport/50769/stable29.tar.gz nextcloud-server-backport/50769/stable29.zip |
fix(SharedStorage): Check if storage ID is set on cachebackport/50769/stable29
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
-rw-r--r-- | apps/files_sharing/lib/SharedStorage.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/apps/files_sharing/lib/SharedStorage.php b/apps/files_sharing/lib/SharedStorage.php index 90602f1a59c..8bcaeede731 100644 --- a/apps/files_sharing/lib/SharedStorage.php +++ b/apps/files_sharing/lib/SharedStorage.php @@ -53,6 +53,7 @@ use OCP\Files\NotFoundException; use OCP\Files\Storage\IDisableEncryptionStorage; use OCP\Files\Storage\IStorage; use OCP\Lock\ILockingProvider; +use OCP\Server; use OCP\Share\IShare; use Psr\Log\LoggerInterface; @@ -106,7 +107,7 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto public function __construct($arguments) { $this->ownerView = $arguments['ownerView']; - $this->logger = \OC::$server->get(LoggerInterface::class); + $this->logger = Server::get(LoggerInterface::class); $this->superShare = $arguments['superShare']; $this->groupedShares = $arguments['groupedShares']; @@ -166,7 +167,7 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto } /** @var IRootFolder $rootFolder */ - $rootFolder = \OC::$server->get(IRootFolder::class); + $rootFolder = Server::get(IRootFolder::class); $this->ownerUserFolder = $rootFolder->getUserFolder($this->superShare->getShareOwner()); $sourceId = $this->superShare->getNodeId(); $ownerNodes = $this->ownerUserFolder->getById($sourceId); @@ -455,7 +456,7 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto $this->cache = new \OCA\Files_Sharing\Cache( $storage, $sourceRoot, - \OC::$server->get(CacheDependencies::class), + Server::get(CacheDependencies::class), $this->getShare() ); return $this->cache; @@ -480,10 +481,10 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto // 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'))) { $this->watcher = parent::getWatcher($path, $storage); return $this->watcher; } |