From 2acc97cc251dfaee9013be1f4075c6d26ce3309c Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 10 Jun 2025 19:47:30 +0200 Subject: fix: only store object store config for user when multiple object stores are enabled Signed-off-by: Robin Appelman --- .../Files/ObjectStore/PrimaryObjectStoreConfig.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'lib/private/Files/ObjectStore/PrimaryObjectStoreConfig.php') diff --git a/lib/private/Files/ObjectStore/PrimaryObjectStoreConfig.php b/lib/private/Files/ObjectStore/PrimaryObjectStoreConfig.php index 6d265c8e664..65ee8c0df6c 100644 --- a/lib/private/Files/ObjectStore/PrimaryObjectStoreConfig.php +++ b/lib/private/Files/ObjectStore/PrimaryObjectStoreConfig.php @@ -99,6 +99,11 @@ class PrimaryObjectStoreConfig { return $objectStore || $objectStoreMultiBucket; } + public function hasMultipleObjectStorages(): bool { + $objectStore = $this->config->getSystemValue('objectstore', []); + return isset($objectStore['default']); + } + /** * @return ?array */ @@ -204,11 +209,15 @@ class PrimaryObjectStoreConfig { } public function getObjectStoreForUser(IUser $user): string { - $value = $this->config->getUserValue($user->getUID(), 'homeobjectstore', 'objectstore', null); - if ($value === null) { - $value = $this->resolveAlias('default'); - $this->config->setUserValue($user->getUID(), 'homeobjectstore', 'objectstore', $value); + if ($this->hasMultipleObjectStorages()) { + $value = $this->config->getUserValue($user->getUID(), 'homeobjectstore', 'objectstore', null); + if ($value === null) { + $value = $this->resolveAlias('default'); + $this->config->setUserValue($user->getUID(), 'homeobjectstore', 'objectstore', $value); + } + return $value; + } else { + return 'default'; } - return $value; } } -- cgit v1.2.3