Skip to content

Commit

Permalink
fix(core): unsupported browser redirect url
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv authored and backportbot[bot] committed Jun 2, 2024
1 parent 806e390 commit ca27acf
Show file tree
Hide file tree
Showing 40 changed files with 52,026 additions and 2 deletions.
4 changes: 3 additions & 1 deletion core/Controller/UnsupportedBrowserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public function __construct(IRequest $request) {
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);
}
}
12 changes: 11 additions & 1 deletion core/src/views/UnsupportedBrowser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,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('/')
},
Expand Down
Loading

0 comments on commit ca27acf

Please sign in to comment.