diff options
author | John Molakvoæ <skjnldsv@protonmail.com> | 2022-10-14 11:35:16 +0200 |
---|---|---|
committer | Vincent Petry <vincent@nextcloud.com> | 2022-10-14 16:18:40 +0200 |
commit | a8e90a03fcf4e960545c4926bb2a8895960d8fdb (patch) | |
tree | 673da19bc403f9391d966dc013f2e195318807c7 /apps/theming | |
parent | e4ff84d468acf3c0e2d497412b7192651bbd4e23 (diff) | |
download | nextcloud-server-a8e90a03fcf4e960545c4926bb2a8895960d8fdb.tar.gz nextcloud-server-a8e90a03fcf4e960545c4926bb2a8895960d8fdb.zip |
Properly use user background cachebuster
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/theming')
-rw-r--r-- | apps/theming/lib/ImageManager.php | 3 | ||||
-rw-r--r-- | apps/theming/lib/Themes/DefaultTheme.php | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/apps/theming/lib/ImageManager.php b/apps/theming/lib/ImageManager.php index 8a84ed55302..60b695f1c90 100644 --- a/apps/theming/lib/ImageManager.php +++ b/apps/theming/lib/ImageManager.php @@ -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); } diff --git a/apps/theming/lib/Themes/DefaultTheme.php b/apps/theming/lib/Themes/DefaultTheme.php index 4dce1dca809..12ed8c765f9 100644 --- a/apps/theming/lib/Themes/DefaultTheme.php +++ b/apps/theming/lib/Themes/DefaultTheme.php @@ -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) === '#') { |