summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@protonmail.com>2022-12-11 15:37:29 +0100
committerJohn Molakvoæ <skjnldsv@protonmail.com>2023-10-19 11:54:09 +0200
commita024ee1cfe89504932e795d721e9784227a88ada (patch)
treeffb801f87c2408ffabf93d1b292c600019a2c3ab /apps
parentd10c4c3f6dc619676672655d274c4dc8c87e3138 (diff)
downloadnextcloud-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.php2
-rw-r--r--apps/theming/lib/ImageManager.php7
-rw-r--r--apps/theming/lib/Themes/CommonThemeTrait.php2
-rw-r--r--apps/theming/lib/ThemingDefaults.php1
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;
}