Merge pull request #45622 from nextcloud/backport/45494/stable28

This commit is contained in:
John Molakvoæ 2024-06-04 15:48:39 +02:00 committed by GitHub
commit 86635c3965
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 6 deletions

View file

@ -49,6 +49,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);
}
}

View file

@ -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'
@ -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('/')
},

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long