diff options
author | Joas Schilling <coding@schilljs.com> | 2021-10-13 15:45:42 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-10-13 15:45:42 +0200 |
commit | da73990d1c407645bdbf0b52d30889c995b6c11b (patch) | |
tree | 0be525bde16ad40525c1f97bcab366b7d8b2095d /apps/theming | |
parent | b585cf1ea1baeb7bbfaf22953e48bbd33e8381fa (diff) | |
download | nextcloud-server-da73990d1c407645bdbf0b52d30889c995b6c11b.tar.gz nextcloud-server-da73990d1c407645bdbf0b52d30889c995b6c11b.zip |
Don't setup the filesystem to check for a favicon we don't use anyway
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/theming')
-rw-r--r-- | apps/theming/lib/ThemingDefaults.php | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php index 1f44c237182..3bfccda4a43 100644 --- a/apps/theming/lib/ThemingDefaults.php +++ b/apps/theming/lib/ThemingDefaults.php @@ -43,6 +43,7 @@ namespace OCA\Theming; use OCP\App\AppPathNotFoundException; use OCP\App\IAppManager; use OCP\Files\NotFoundException; +use OCP\Files\SimpleFS\ISimpleFile; use OCP\ICacheFactory; use OCP\IConfig; use OCP\IL10N; @@ -363,17 +364,11 @@ class ThemingDefaults extends \OC_Defaults { } $cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0'); - try { - $customFavicon = $this->imageManager->getImage('favicon'); - } catch (NotFoundException $e) { - $customFavicon = null; - } - $route = false; - if ($image === 'favicon.ico' && ($customFavicon !== null || $this->imageManager->shouldReplaceIcons())) { + if ($image === 'favicon.ico' && ($this->imageManager->shouldReplaceIcons() || $this->getCustomFavicon() !== null)) { $route = $this->urlGenerator->linkToRoute('theming.Icon.getFavicon', ['app' => $app]); } - if (($image === 'favicon-touch.png' || $image === 'favicon-fb.png') && ($customFavicon !== null || $this->imageManager->shouldReplaceIcons())) { + if (($image === 'favicon-touch.png' || $image === 'favicon-fb.png') && ($this->imageManager->shouldReplaceIcons() || $this->getCustomFavicon() !== null)) { $route = $this->urlGenerator->linkToRoute('theming.Icon.getTouchIcon', ['app' => $app]); } if ($image === 'manifest.json') { @@ -397,6 +392,14 @@ class ThemingDefaults extends \OC_Defaults { return false; } + protected function getCustomFavicon(): ?ISimpleFile { + try { + return $this->imageManager->getImage('favicon'); + } catch (NotFoundException $e) { + return null; + } + } + /** * Increases the cache buster key */ |