mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 08:16:43 -04:00
Merge pull request #45494 from nextcloud/fix/unsupported-redirect
This commit is contained in:
commit
d045482732
4 changed files with 22 additions and 9 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,13 +31,14 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
// eslint-disable-next-line n/no-extraneous-import
|
||||
import { agents } from 'caniuse-lite/dist/unpacker/agents.js'
|
||||
import { generateUrl, getRootUrl } from '@nextcloud/router'
|
||||
import { translate as t, translatePlural as n } from '@nextcloud/l10n'
|
||||
|
||||
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
|
||||
import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent.js'
|
||||
import Web from 'vue-material-design-icons/Web.vue'
|
||||
// eslint-disable-next-line n/no-extraneous-import
|
||||
import { agents } from 'caniuse-lite/dist/unpacker/agents.js'
|
||||
|
||||
import { browserStorageKey } from '../utils/RedirectUnsupportedBrowsers.js'
|
||||
import { supportedBrowsers } from '../services/BrowsersListService.js'
|
||||
|
|
@ -112,12 +113,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('/')
|
||||
},
|
||||
|
||||
|
|
|
|||
6
dist/core-unsupported-browser.js
vendored
6
dist/core-unsupported-browser.js
vendored
File diff suppressed because one or more lines are too long
2
dist/core-unsupported-browser.js.map
vendored
2
dist/core-unsupported-browser.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue