From e1ade0e4e6e1290e33973efebd7b19197a27d6f8 Mon Sep 17 00:00:00 2001 From: "Md. Shahriar Karim Shawon" Date: Tue, 15 Sep 2026 16:32:46 +0600 Subject: [PATCH] fix(theming): read image keys from Mime-suffixed storage key in theming:config occ theming:config always reported image keys (background, logo, logoheader, favicon) as "currently not set", even when a value was configured and served correctly by the web UI. Image values are stored under "Mime" in the theming app config, a convention already used by this command's list-all branch and by the value-writing branch further down. The single-key read branch was the only one still reading the plain key, so it never found the stored value. Assisted-by: ClaudeCode:claude-sonnet-5 Signed-off-by: Md. Shahriar Karim Shawon --- apps/theming/lib/Command/UpdateConfig.php | 3 +- .../tests/Command/UpdateConfigTest.php | 70 +++++++++++++++++++ 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 apps/theming/tests/Command/UpdateConfigTest.php diff --git a/apps/theming/lib/Command/UpdateConfig.php b/apps/theming/lib/Command/UpdateConfig.php index 14f8e1d5f04bd..5a6edea4b779f 100644 --- a/apps/theming/lib/Command/UpdateConfig.php +++ b/apps/theming/lib/Command/UpdateConfig.php @@ -86,7 +86,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int } if ($value === null) { - $value = $this->config->getAppValue('theming', $key, ''); + $storageKey = in_array($key, ImageManager::SUPPORTED_IMAGE_KEYS, true) ? $key . 'Mime' : $key; + $value = $this->config->getAppValue('theming', $storageKey, ''); if ($value !== '') { $output->writeln('' . $key . ' is currently set to ' . $value . ''); } else { diff --git a/apps/theming/tests/Command/UpdateConfigTest.php b/apps/theming/tests/Command/UpdateConfigTest.php new file mode 100644 index 0000000000000..3a15ed69e6d68 --- /dev/null +++ b/apps/theming/tests/Command/UpdateConfigTest.php @@ -0,0 +1,70 @@ +themingDefaults = $this->createMock(ThemingDefaults::class); + $this->imageManager = $this->createMock(ImageManager::class); + $this->config = $this->createMock(IConfig::class); + + $command = new UpdateConfig($this->themingDefaults, $this->imageManager, $this->config); + $this->cmd = new CommandTester($command); + } + + public function testReadRegularKeyThatIsSet(): void { + $this->config->expects($this->once()) + ->method('getAppValue') + ->with('theming', 'name', '') + ->willReturn('My Cloud'); + + $this->cmd->execute(['key' => 'name']); + + $this->assertStringContainsString('name is currently set to My Cloud', $this->cmd->getDisplay()); + } + + public function testReadImageKeyThatIsSetReadsFromMimeSuffixedStorageKey(): void { + $this->config->expects($this->once()) + ->method('getAppValue') + ->with('theming', 'logoMime', '') + ->willReturn('image/png'); + + $this->cmd->execute(['key' => 'logo']); + + $this->assertStringContainsString('logo is currently set to image/png', $this->cmd->getDisplay()); + } + + public function testReadImageKeyThatIsNotSet(): void { + $this->config->expects($this->once()) + ->method('getAppValue') + ->with('theming', 'logoMime', '') + ->willReturn(''); + + $this->cmd->execute(['key' => 'logo']); + + $this->assertStringContainsString('logo is currently not set', $this->cmd->getDisplay()); + } +}