Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Don't setup the filesystem to check for a favicon we don't use anyway
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen authored and backportbot[bot] committed Oct 13, 2021
commit 07138686e2458a2fe9b1f83cead9cacc898d5940
19 changes: 11 additions & 8 deletions apps/theming/lib/ThemingDefaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
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;
Expand Down Expand Up @@ -354,17 +355,11 @@ public function replaceImagePath($app, $image) {
}
$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') {
Expand All @@ -388,6 +383,14 @@ public function replaceImagePath($app, $image) {
return false;
}

protected function getCustomFavicon(): ?ISimpleFile {
try {
return $this->imageManager->getImage('favicon');
} catch (NotFoundException $e) {
return null;
}
}

/**
* Increases the cache buster key
*/
Expand Down