]> source.dussan.org Git - nextcloud-server.git/commitdiff
Properly use user background cachebuster
authorJohn Molakvoæ <skjnldsv@protonmail.com>
Fri, 14 Oct 2022 09:35:16 +0000 (11:35 +0200)
committerVincent Petry <vincent@nextcloud.com>
Fri, 14 Oct 2022 14:18:40 +0000 (16:18 +0200)
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
apps/theming/lib/ImageManager.php
apps/theming/lib/Themes/DefaultTheme.php

index 8a84ed55302ee6ae3eb46111857d1928f68c4596..60b695f1c90b7c13b743c4243925ff507c52c2dd 100644 (file)
@@ -106,9 +106,11 @@ class ImageManager {
        public function getImage(string $key, bool $useSvg = true): ISimpleFile {
                $logo = $this->config->getAppValue('theming', $key . 'Mime', '');
                $folder = $this->getRootFolder()->getFolder('images');
+
                if ($logo === '' || !$folder->fileExists($key)) {
                        throw new NotFoundException();
                }
+
                if (!$useSvg && $this->shouldReplaceIcons()) {
                        if (!$folder->fileExists($key . '.png')) {
                                try {
@@ -126,6 +128,7 @@ class ImageManager {
                                return $folder->getFile($key . '.png');
                        }
                }
+
                return $folder->getFile($key);
        }
 
index 4dce1dca809b3fd3488963e0319e8870968859c0..12ed8c765f9d4e43e007101683ab16ec19a29e54 100644 (file)
@@ -239,9 +239,10 @@ class DefaultTheme implements ITheme {
                $user = $this->userSession->getUser();
                if ($appManager->isEnabledForUser(Application::APP_ID) && $user !== null) {
                        $themingBackground = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'background', 'default');
+                       $currentVersion = (int)$this->config->getUserValue($user->getUID(), Application::APP_ID, 'backgroundVersion', '0');
 
                        if ($themingBackground === 'custom') {
-                               $variables['--image-main-background'] = "url('" . $this->urlGenerator->linkToRouteAbsolute('theming.userTheme.getBackground') . "')";
+                               $variables['--image-main-background'] = "url('" . $this->urlGenerator->linkToRouteAbsolute('theming.userTheme.getBackground') . "?v=$currentVersion')";
                        } elseif (isset(BackgroundService::SHIPPED_BACKGROUNDS[$themingBackground])) {
                                $variables['--image-main-background'] = "url('" . $this->urlGenerator->linkTo(Application::APP_ID, "/img/background/$themingBackground") . "')";
                        } elseif (substr($themingBackground, 0, 1) === '#') {