iports/ilot/nextcloud30/50813_check-if-storage-id-is-set-on-cache.patch
Antoine Martin 0476da5791
Some checks failed
/ lint (pull_request) Failing after 28s
/ deploy-x86_64 (pull_request) Successful in 52s
/ build-x86_64 (pull_request) Successful in 3m54s
/ deploy-aarch64 (pull_request) Successful in 1m13s
/ build-aarch64 (pull_request) Successful in 12m2s
ilot/nextcloud: new aport
2025-03-01 09:38:53 -05:00

62 lines
2.8 KiB
Diff

From 59a0bc99824402fc126e58dfcc8da68fc6e41349 Mon Sep 17 00:00:00 2001
From: Git'Fellow <12234510+solracsf@users.noreply.github.com>
Date: Wed, 12 Feb 2025 11:30:14 +0100
Subject: [PATCH] fix(SharedStorage): Check if storage ID is set on cache
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
---
apps/files_sharing/lib/SharedStorage.php | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/apps/files_sharing/lib/SharedStorage.php b/apps/files_sharing/lib/SharedStorage.php
index 2ac157f7970b6..a70632d6faa54 100644
--- a/apps/files_sharing/lib/SharedStorage.php
+++ b/apps/files_sharing/lib/SharedStorage.php
@@ -29,6 +29,7 @@ use OCP\Files\Storage\IDisableEncryptionStorage;
use OCP\Files\Storage\ISharedStorage;
use OCP\Files\Storage\IStorage;
use OCP\Lock\ILockingProvider;
+use OCP\Server;
use OCP\Share\IShare;
use Psr\Log\LoggerInterface;
@@ -82,7 +83,7 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements LegacyISha
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'];
@@ -142,7 +143,7 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements LegacyISha
}
/** @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);
@@ -431,7 +432,7 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements LegacyISha
$this->cache = new \OCA\Files_Sharing\Cache(
$storage,
$sourceRoot,
- \OC::$server->get(CacheDependencies::class),
+ Server::get(CacheDependencies::class),
$this->getShare()
);
return $this->cache;
@@ -456,10 +457,10 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements LegacyISha
// 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;
}