Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
fix(core): unsupported browser redirect url
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
  • Loading branch information
skjnldsv authored and nextcloud-command committed Jun 4, 2024
commit a2f7b59d340db29d17f97452eb4dc5be28688535
4 changes: 3 additions & 1 deletion core/Controller/UnsupportedBrowserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,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 @@ -140,12 +140,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