Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Slaughter <pslaughter@gitlab.com>2018-07-19 16:20:26 +0300
committerPaul Slaughter <pslaughter@gitlab.com>2018-07-19 22:00:17 +0300
commit133377147b893319db1353dd78322261ce92b59d (patch)
tree7ced26c46f31a1ea6c0cdf69f61bc67f11e14f3f /app/assets/javascripts/ide/ide_router.js
parent66f5be832b40355bda2a56af31c112bfddedb7b1 (diff)
Fix Web IDE router breaking on files matching "targetmode"
Diffstat (limited to 'app/assets/javascripts/ide/ide_router.js')
-rw-r--r--app/assets/javascripts/ide/ide_router.js22
1 files changed, 17 insertions, 5 deletions
diff --git a/app/assets/javascripts/ide/ide_router.js b/app/assets/javascripts/ide/ide_router.js
index 44c35e9a5a5..c6d7d218e81 100644
--- a/app/assets/javascripts/ide/ide_router.js
+++ b/app/assets/javascripts/ide/ide_router.js
@@ -1,5 +1,6 @@
import Vue from 'vue';
import VueRouter from 'vue-router';
+import { join as joinPath } from 'path';
import flash from '~/flash';
import store from './stores';
import { activityBarViews } from './constants';
@@ -37,17 +38,29 @@ const router = new VueRouter({
base: `${gon.relative_url_root}/-/ide/`,
routes: [
{
- path: '/project/:namespace/:project+',
+ path: '/project/:namespace+/:project',
component: EmptyRouterComponent,
children: [
{
- path: ':targetmode(edit|tree|blob)/*',
+ path: ':targetmode(edit|tree|blob)/:branchid+/-/*',
component: EmptyRouterComponent,
},
{
+ path: ':targetmode(edit|tree|blob)/:branchid+/',
+ redirect: to => joinPath(to.path, '/-/'),
+ },
+ {
+ path: ':targetmode(edit|tree|blob)',
+ redirect: to => joinPath(to.path, '/master/-/'),
+ },
+ {
path: 'merge_requests/:mrid',
component: EmptyRouterComponent,
},
+ {
+ path: '',
+ redirect: to => joinPath(to.path, '/edit/master/-/'),
+ },
],
},
],
@@ -63,11 +76,10 @@ router.beforeEach((to, from, next) => {
.then(() => {
const fullProjectId = `${to.params.namespace}/${to.params.project}`;
- const baseSplit = (to.params[0] && to.params[0].split('/-/')) || [''];
- const branchId = baseSplit[0].slice(-1) === '/' ? baseSplit[0].slice(0, -1) : baseSplit[0];
+ const branchId = to.params.branchid;
if (branchId) {
- const basePath = baseSplit.length > 1 ? baseSplit[1] : '';
+ const basePath = to.params[0] || '';
store.dispatch('setCurrentBranchId', branchId);