Skip to content
Snippets Groups Projects
Unverified Commit 512eb14d authored by Robin Appelman's avatar Robin Appelman
Browse files

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: default avatarRobin Appelman <robin@icewind.nl>
parent 64f1ad93
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment