diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2024-05-24 11:03:22 +0200 |
---|---|---|
committer | skjnldsv <skjnldsv@protonmail.com> | 2024-06-01 09:34:22 +0200 |
commit | fc3ee6552627613b87306ba7aa95d30d51b88695 (patch) | |
tree | 79d84c582fbe187dc939b2676aaad322dacabc7e /core | |
parent | 2a5d3fd92a36315ef910d1217123b6a860c689e5 (diff) | |
download | nextcloud-server-fc3ee6552627613b87306ba7aa95d30d51b88695.tar.gz nextcloud-server-fc3ee6552627613b87306ba7aa95d30d51b88695.zip |
fix(core): unsupported browser redirect url
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/Controller/UnsupportedBrowserController.php | 4 | ||||
-rw-r--r-- | core/src/views/UnsupportedBrowser.vue | 12 |
2 files changed, 14 insertions, 2 deletions
diff --git a/core/Controller/UnsupportedBrowserController.php b/core/Controller/UnsupportedBrowserController.php index 952f602a93c..b8efe2539f1 100644 --- a/core/Controller/UnsupportedBrowserController.php +++ b/core/Controller/UnsupportedBrowserController.php @@ -33,6 +33,8 @@ class UnsupportedBrowserController extends Controller { public function index(): Response { Util::addScript('core', 'unsupported-browser'); Util::addStyle('core', 'icons'); - return new TemplateResponse('core', 'unsupportedbrowser', [], TemplateResponse::RENDER_AS_ERROR); + + // not using RENDER_AS_ERROR as we need the JSConfigHelper for url generation + return new TemplateResponse('core', 'unsupportedbrowser', [], TemplateResponse::RENDER_AS_GUEST); } } diff --git a/core/src/views/UnsupportedBrowser.vue b/core/src/views/UnsupportedBrowser.vue index 6754503f69f..c0331cb1f9b 100644 --- a/core/src/views/UnsupportedBrowser.vue +++ b/core/src/views/UnsupportedBrowser.vue @@ -112,12 +112,22 @@ export default { // Redirect if there is the data const urlParams = new URLSearchParams(window.location.search) if (urlParams.has('redirect_url')) { - const redirectPath = Buffer.from(urlParams.get('redirect_url'), 'base64').toString() || '/' + let redirectPath = Buffer.from(urlParams.get('redirect_url'), 'base64').toString() || '/' + + // remove index.php and double slashes + redirectPath = redirectPath + .replace('index.php', '') + .replace(getRootUrl(), '') + .replace(/\/\//g, '/') + + // if we have a valid redirect url, use it if (redirectPath.startsWith('/')) { window.location = generateUrl(redirectPath) return } } + + // else redirect to root window.location = generateUrl('/') }, |