From 7f9dabd984282c1ed5d62132c6137a8e88dea925 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Wed, 28 Mar 2018 12:24:51 +0200 Subject: [PATCH] Make sure the custom favicon is used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/theming/lib/ThemingDefaults.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php index 03d5a3f061..2e6b667b1f 100644 --- a/apps/theming/lib/ThemingDefaults.php +++ b/apps/theming/lib/ThemingDefaults.php @@ -270,10 +270,16 @@ class ThemingDefaults extends \OC_Defaults { } $cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0'); - if ($image === 'favicon.ico' && $this->shouldReplaceIcons()) { + try { + $customFavicon = $this->imageManager->getImage('favicon'); + } catch (NotFoundException $e) { + $customFavicon = null; + } + + if ($image === 'favicon.ico' && ($customFavicon !== null || $this->shouldReplaceIcons())) { return $this->urlGenerator->linkToRoute('theming.Icon.getFavicon', ['app' => $app]) . '?v=' . $cacheBusterValue; } - if ($image === 'favicon-touch.png' && $this->shouldReplaceIcons()) { + if ($image === 'favicon-touch.png' && ($customFavicon !== null || $this->shouldReplaceIcons())) { return $this->urlGenerator->linkToRoute('theming.Icon.getTouchIcon', ['app' => $app]) . '?v=' . $cacheBusterValue; } if ($image === 'manifest.json') { @@ -318,6 +324,8 @@ class ThemingDefaults extends \OC_Defaults { $cacheBusterKey = $this->config->getAppValue('theming', 'cachebuster', '0'); $this->config->setAppValue('theming', 'cachebuster', (int)$cacheBusterKey+1); $this->cacheFactory->createDistributed('theming-')->clear(); + $this->cacheFactory->createDistributed('imagePath')->clear(); + } /**