summaryrefslogtreecommitdiffstats
path: root/apps/theming
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2019-10-18 18:11:34 +0200
committerRobin Appelman <robin@icewind.nl>2019-10-18 18:12:06 +0200
commit512eb14d946167ab1ba2b7c25b40b2a4367aaaca (patch)
treec513d4fb6be22ebb81ec64b0dfded0ce012dd9e8 /apps/theming
parent64f1ad9381672619c8d449ef32377b0fa0c11eff (diff)
downloadnextcloud-server-512eb14d946167ab1ba2b7c25b40b2a4367aaaca.tar.gz
nextcloud-server-512eb14d946167ab1ba2b7c25b40b2a4367aaaca.zip
make sure that the urls for theming images are valid
In some circumstances the url generation seems to fail, resulting in an empty image url which causes the browser to load the main page multiple times, leading to issues with state tokens Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/theming')
-rw-r--r--apps/theming/lib/ThemingDefaults.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php
index 8e65fafe850..ec96889fdeb 100644
--- a/apps/theming/lib/ThemingDefaults.php
+++ b/apps/theming/lib/ThemingDefaults.php
@@ -334,11 +334,12 @@ class ThemingDefaults extends \OC_Defaults {
$customFavicon = null;
}
+ $route = false;
if ($image === 'favicon.ico' && ($customFavicon !== null || $this->imageManager->shouldReplaceIcons())) {
- return $this->urlGenerator->linkToRoute('theming.Icon.getFavicon', ['app' => $app]) . '?v=' . $cacheBusterValue;
+ $route = $this->urlGenerator->linkToRoute('theming.Icon.getFavicon', ['app' => $app]);
}
if ($image === 'favicon-touch.png' && ($customFavicon !== null || $this->imageManager->shouldReplaceIcons())) {
- return $this->urlGenerator->linkToRoute('theming.Icon.getTouchIcon', ['app' => $app]) . '?v=' . $cacheBusterValue;
+ $route = $this->urlGenerator->linkToRoute('theming.Icon.getTouchIcon', ['app' => $app]);
}
if ($image === 'manifest.json') {
try {
@@ -347,11 +348,16 @@ class ThemingDefaults extends \OC_Defaults {
return false;
}
} catch (AppPathNotFoundException $e) {}
- return $this->urlGenerator->linkToRoute('theming.Theming.getManifest') . '?v=' . $cacheBusterValue;
+ $route = $this->urlGenerator->linkToRoute('theming.Theming.getManifest');
}
if (strpos($image, 'filetypes/') === 0 && file_exists(\OC::$SERVERROOT . '/core/img/' . $image )) {
- return $this->urlGenerator->linkToRoute('theming.Icon.getThemedIcon', ['app' => $app, 'image' => $image]);
+ $route = $this->urlGenerator->linkToRoute('theming.Icon.getThemedIcon', ['app' => $app, 'image' => $image]);
}
+
+ if ($route) {
+ return $route . '?v=' . $cacheBusterValue;
+ }
+
return false;
}