aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGit'Fellow <12234510+solracsf@users.noreply.github.com>2025-02-12 11:30:14 +0100
committerGit'Fellow <12234510+solracsf@users.noreply.github.com>2025-02-13 08:29:20 +0100
commitbc3be77a69cb956ee51347c786108e0777b8f2cc (patch)
treee20db1a0f12eee3ee8a21f5b716d963a6dd995e6
parent167a78ff54e8ef86959e24c844bba6fc7ae09be2 (diff)
downloadnextcloud-server-bc3be77a69cb956ee51347c786108e0777b8f2cc.tar.gz
nextcloud-server-bc3be77a69cb956ee51347c786108e0777b8f2cc.zip
fix(SharedStorage): Check if storage ID is set on cachecheckStorageIdSetCache
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
-rw-r--r--apps/files_sharing/lib/SharedStorage.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/apps/files_sharing/lib/SharedStorage.php b/apps/files_sharing/lib/SharedStorage.php
index 539d3958e8d..313f525d4b4 100644
--- a/apps/files_sharing/lib/SharedStorage.php
+++ b/apps/files_sharing/lib/SharedStorage.php
@@ -36,6 +36,7 @@ use OCP\Files\Storage\ILockingStorage;
use OCP\Files\Storage\ISharedStorage;
use OCP\Files\Storage\IStorage;
use OCP\Lock\ILockingProvider;
+use OCP\Server;
use OCP\Share\IShare;
use OCP\Util;
use Psr\Log\LoggerInterface;
@@ -90,7 +91,7 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage
public function __construct(array $parameters) {
$this->ownerView = $parameters['ownerView'];
- $this->logger = \OC::$server->get(LoggerInterface::class);
+ $this->logger = Server::get(LoggerInterface::class);
$this->superShare = $parameters['superShare'];
$this->groupedShares = $parameters['groupedShares'];
@@ -150,7 +151,7 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage
}
/** @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);
@@ -412,7 +413,7 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage
$this->cache = new Cache(
$storage,
$sourceRoot,
- \OC::$server->get(CacheDependencies::class),
+ Server::get(CacheDependencies::class),
$this->getShare()
);
return $this->cache;
@@ -437,16 +438,15 @@ class SharedStorage extends Jail implements LegacyISharedStorage, ISharedStorage
// 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;
}
}