Set no rewrite for generateUrl, in case URL contains index.php despite configured rewrite

Signed-off-by: Ivan Sein <ivan@nextcloud.com>
This commit is contained in:
Ivan Sein 2020-01-22 13:52:17 +01:00
Родитель cba9d4e9d9
Коммит d7bfddb22f
1 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -22,18 +22,24 @@
import Vue from 'vue' import Vue from 'vue'
import Router from 'vue-router' import Router from 'vue-router'
import { generateUrl } from '@nextcloud/router' import { getRootUrl, generateUrl } from '@nextcloud/router'
import MainView from '../views/MainView.vue' import MainView from '../views/MainView.vue'
import NotFoundView from '../views/NotFoundView.vue' import NotFoundView from '../views/NotFoundView.vue'
import WelcomeView from '../views/WelcomeView.vue' import WelcomeView from '../views/WelcomeView.vue'
Vue.use(Router) Vue.use(Router)
const webRootWithIndexPHP = getRootUrl() + '/index.php'
const doesURLContainIndexPHP = window.location.pathname.startsWith(webRootWithIndexPHP)
const base = generateUrl('/', {}, {
noRewrite: doesURLContainIndexPHP,
})
export default new Router({ export default new Router({
mode: 'history', mode: 'history',
// if index.php is in the url AND we got this far, then it's working: // if index.php is in the url AND we got this far, then it's working:
// let's keep using index.php in the url // let's keep using index.php in the url
base: generateUrl('/', ''), base,
linkActiveClass: 'active', linkActiveClass: 'active',
routes: [ routes: [
{ {