Skip to content

Commit 036d52a

Browse files
committed
fix(theming): use IAppConfig instead of deprecated IConfig::getAppValue
Replace two deprecated IConfig::getAppValue() calls in ThemingController with IAppConfig::getAppValueString(): - getImage(): MIME type lookup for the original extensionless stored file - getManifest(): cachebuster value lookup Signed-off-by: Anna Larch <anna@nextcloud.com> AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Anna Larch <anna@nextcloud.com>
1 parent 6db3183 commit 036d52a

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

apps/theming/lib/Controller/ThemingController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ public function getImage(string $key, bool $useSvg = true) {
376376
// application/octet-stream for it. Use the config-stored MIME type for the original
377377
// file, and getMimeType() only for converted files which have a proper extension.
378378
$mimeType = $file->getName() === $key
379-
? $this->config->getAppValue($this->appName, $key . 'Mime', '')
379+
? $this->appConfig->getAppValueString($key . 'Mime', '')
380380
: $file->getMimeType();
381381
$response->addHeader('Content-Type', $mimeType);
382382
$response->addHeader('Content-Disposition', 'attachment; filename="' . $key . '"');
@@ -456,7 +456,7 @@ public function getThemeStylesheet(string $themeId, bool $plain = false, bool $w
456456
#[BruteForceProtection(action: 'manifest')]
457457
#[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)]
458458
public function getManifest(string $app): JSONResponse {
459-
$cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0');
459+
$cacheBusterValue = $this->appConfig->getAppValueString('cachebuster', '0');
460460
if ($app === 'core' || $app === 'settings') {
461461
$name = $this->themingDefaults->getName();
462462
$shortName = $this->themingDefaults->getName();

apps/theming/tests/Controller/ThemingControllerTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -676,10 +676,10 @@ public function testGetLogoOriginalFile(): void {
676676
$this->imageManager->expects($this->once())
677677
->method('getImage')
678678
->willReturn($file);
679-
$this->config
680-
->expects($this->any())
681-
->method('getAppValue')
682-
->with('theming', 'logoMime', '')
679+
$this->appConfig
680+
->expects($this->once())
681+
->method('getAppValueString')
682+
->with('logoMime', '')
683683
->willReturn('image/png');
684684

685685
@$expected = new FileDisplayResponse($file);
@@ -734,10 +734,10 @@ public static function dataGetManifest(): array {
734734

735735
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataGetManifest')]
736736
public function testGetManifest(bool $standalone): void {
737-
$this->config
737+
$this->appConfig
738738
->expects($this->once())
739-
->method('getAppValue')
740-
->with('theming', 'cachebuster', '0')
739+
->method('getAppValueString')
740+
->with('cachebuster', '0')
741741
->willReturn('0');
742742
$this->themingDefaults
743743
->expects($this->any())

0 commit comments

Comments
 (0)