diff options
author | John Molakvoæ <skjnldsv@protonmail.com> | 2022-12-11 15:37:29 +0100 |
---|---|---|
committer | John Molakvoæ <skjnldsv@protonmail.com> | 2023-10-19 11:54:09 +0200 |
commit | a024ee1cfe89504932e795d721e9784227a88ada (patch) | |
tree | ffb801f87c2408ffabf93d1b292c600019a2c3ab /apps | |
parent | d10c4c3f6dc619676672655d274c4dc8c87e3138 (diff) | |
download | nextcloud-server-a024ee1cfe89504932e795d721e9784227a88ada.tar.gz nextcloud-server-a024ee1cfe89504932e795d721e9784227a88ada.zip |
Fix background removal check
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/theming/lib/Controller/ThemingController.php | 2 | ||||
-rw-r--r-- | apps/theming/lib/ImageManager.php | 7 | ||||
-rw-r--r-- | apps/theming/lib/Themes/CommonThemeTrait.php | 2 | ||||
-rw-r--r-- | apps/theming/lib/ThemingDefaults.php | 1 |
4 files changed, 7 insertions, 5 deletions
diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php index e685424982f..1d6d5100a46 100644 --- a/apps/theming/lib/Controller/ThemingController.php +++ b/apps/theming/lib/Controller/ThemingController.php @@ -156,7 +156,7 @@ class ThemingController extends Controller { } break; case 'disable-user-theming': - if ($value !== "yes" && $value !== "no") { + if ($value !== 'yes' && $value !== 'no') { $error = $this->l10n->t('Disable-user-theming should be true or false'); } break; diff --git a/apps/theming/lib/ImageManager.php b/apps/theming/lib/ImageManager.php index c577e099a96..f536bae0421 100644 --- a/apps/theming/lib/ImageManager.php +++ b/apps/theming/lib/ImageManager.php @@ -97,10 +97,10 @@ class ImageManager { * @throws NotPermittedException */ public function getImage(string $key, bool $useSvg = true): ISimpleFile { - $logo = $this->config->getAppValue('theming', $key . 'Mime', ''); + $mime = $this->config->getAppValue('theming', $key . 'Mime', ''); $folder = $this->getRootFolder()->getFolder('images'); - if ($logo === '' || !$folder->fileExists($key)) { + if ($mime === '' || !$folder->fileExists($key)) { throw new NotFoundException(); } @@ -127,7 +127,8 @@ class ImageManager { public function hasImage(string $key): bool { $mimeSetting = $this->config->getAppValue('theming', $key . 'Mime', ''); - return $mimeSetting !== ''; + // Removing the background defines its mime as 'backgroundColor' + return $mimeSetting !== '' && $mimeSetting !== 'backgroundColor'; } /** diff --git a/apps/theming/lib/Themes/CommonThemeTrait.php b/apps/theming/lib/Themes/CommonThemeTrait.php index 1aa1174fabc..eaf76360193 100644 --- a/apps/theming/lib/Themes/CommonThemeTrait.php +++ b/apps/theming/lib/Themes/CommonThemeTrait.php @@ -97,7 +97,7 @@ trait CommonThemeTrait { foreach (ImageManager::SUPPORTED_IMAGE_KEYS as $image) { if ($this->imageManager->hasImage($image)) { $imageUrl = $this->imageManager->getImageUrl($image); - // --image-background is overridden by user theming + // --image-background is overridden by user theming if logged in $variables["--image-$image"] = "url('" . $imageUrl . "')"; } } diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php index 7de87389f18..21ab853a140 100644 --- a/apps/theming/lib/ThemingDefaults.php +++ b/apps/theming/lib/ThemingDefaults.php @@ -487,6 +487,7 @@ class ThemingDefaults extends \OC_Defaults { case 'background': case 'favicon': $this->imageManager->delete($setting); + $this->config->deleteAppValue('theming', $setting . 'Mime'); break; } |