Skip to content

Commit

Permalink
Merge pull request #45624 from nextcloud/backport/45494/stable27
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored Jun 4, 2024
2 parents 849587a + 737084e commit 3663c4a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
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);
}
}
15 changes: 13 additions & 2 deletions core/src/views/UnsupportedBrowser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@
</template>

<script>
import { generateUrl } from '@nextcloud/router'
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'
Expand Down Expand Up @@ -140,12 +141,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
4 changes: 2 additions & 2 deletions dist/core-unsupported-browser.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/core-unsupported-browser.js.map

Large diffs are not rendered by default.

0 comments on commit 3663c4a

Please sign in to comment.