From 80f6dcf73a5fcdf1734d69e88810204c958e5f70 Mon Sep 17 00:00:00 2001 From: Dillard Blom Date: Wed, 30 Sep 2026 13:30:01 +0200 Subject: [PATCH] fix(config): refresh a category cache stored with another type If cache-categories was stored with a type other than mixed or array, for example set by hand with occ, the typed read throws. Treat that as a missing cache so it is refreshed instead of breaking the menu and the settings page. --- lib/Service/CategoryRepository.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Service/CategoryRepository.php b/lib/Service/CategoryRepository.php index 4328dc4..84ab7d3 100644 --- a/lib/Service/CategoryRepository.php +++ b/lib/Service/CategoryRepository.php @@ -5,6 +5,7 @@ namespace OCA\SideMenu\Service; use OC\App\AppStore\Fetcher\CategoryFetcher; use OCA\SideMenu\AppInfo\Application; use OCP\AppFramework\Utility\ITimeFactory; +use OCP\Exceptions\AppConfigTypeConflictException; use OCP\IAppConfig; use OCP\ICache; use OCP\ICacheFactory; @@ -137,7 +138,12 @@ class CategoryRepository return $categories; } } else { - $stored = $this->appConfig->getValueArray(Application::APP_ID, self::CACHE_KEY, [], lazy: true); + try { + $stored = $this->appConfig->getValueArray(Application::APP_ID, self::CACHE_KEY, [], lazy: true); + } catch (AppConfigTypeConflictException) { + // Stored with another type, e.g. set by hand; refreshed below + $stored = []; + } if (isset($stored['expires'], $stored['categories']) && $stored['expires'] > $this->timeFactory->getTime()) { return $stored['categories'];