Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
ebdb0c02
Commit
ebdb0c02
authored
Apr 24, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
ced30f5b
04519162
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
11 deletions
+27
-11
app/assets/javascripts/api.js
app/assets/javascripts/api.js
+2
-5
app/assets/javascripts/ide/ide_router.js
app/assets/javascripts/ide/ide_router.js
+5
-5
app/assets/javascripts/lib/utils/url_utility.js
app/assets/javascripts/lib/utils/url_utility.js
+2
-0
changelogs/unreleased/fix-api-ide-relative-url-root.yml
changelogs/unreleased/fix-api-ide-relative-url-root.yml
+5
-0
spec/javascripts/api_spec.js
spec/javascripts/api_spec.js
+13
-1
No files found.
app/assets/javascripts/api.js
View file @
ebdb0c02
import
$
from
'
jquery
'
;
import
_
from
'
underscore
'
;
import
axios
from
'
./lib/utils/axios_utils
'
;
import
{
joinPaths
}
from
'
./lib/utils/url_utility
'
;
const
Api
=
{
groupsPath
:
'
/api/:version/groups.json
'
,
...
...
@@ -339,11 +340,7 @@ const Api = {
},
buildUrl
(
url
)
{
let
urlRoot
=
''
;
if
(
gon
.
relative_url_root
!=
null
)
{
urlRoot
=
gon
.
relative_url_root
;
}
return
urlRoot
+
url
.
replace
(
'
:version
'
,
gon
.
api_version
);
return
joinPaths
(
gon
.
relative_url_root
||
''
,
url
.
replace
(
'
:version
'
,
gon
.
api_version
));
},
};
...
...
app/assets/javascripts/ide/ide_router.js
View file @
ebdb0c02
import
Vue
from
'
vue
'
;
import
VueRouter
from
'
vue-router
'
;
import
{
join
as
joinPath
}
from
'
path
'
;
import
{
join
Paths
}
from
'
~/lib/utils/url_utility
'
;
import
flash
from
'
~/flash
'
;
import
store
from
'
./stores
'
;
...
...
@@ -34,7 +34,7 @@ const EmptyRouterComponent = {
const
router
=
new
VueRouter
({
mode
:
'
history
'
,
base
:
`
${
gon
.
relative_url_root
}
/-/ide/`
,
base
:
joinPaths
(
gon
.
relative_url_root
||
''
,
'
/-/ide/
'
)
,
routes
:
[
{
path
:
'
/project/:namespace+/:project
'
,
...
...
@@ -46,11 +46,11 @@ const router = new VueRouter({
},
{
path
:
'
:targetmode(edit|tree|blob)/:branchid+/
'
,
redirect
:
to
=>
joinPath
(
to
.
path
,
'
/-/
'
),
redirect
:
to
=>
joinPath
s
(
to
.
path
,
'
/-/
'
),
},
{
path
:
'
:targetmode(edit|tree|blob)
'
,
redirect
:
to
=>
joinPath
(
to
.
path
,
'
/master/-/
'
),
redirect
:
to
=>
joinPath
s
(
to
.
path
,
'
/master/-/
'
),
},
{
path
:
'
merge_requests/:mrid
'
,
...
...
@@ -58,7 +58,7 @@ const router = new VueRouter({
},
{
path
:
''
,
redirect
:
to
=>
joinPath
(
to
.
path
,
'
/edit/master/-/
'
),
redirect
:
to
=>
joinPath
s
(
to
.
path
,
'
/edit/master/-/
'
),
},
],
},
...
...
app/assets/javascripts/lib/utils/url_utility.js
View file @
ebdb0c02
...
...
@@ -120,3 +120,5 @@ export function webIDEUrl(route = undefined) {
}
return
returnUrl
;
}
export
{
join
as
joinPaths
}
from
'
path
'
;
changelogs/unreleased/fix-api-ide-relative-url-root.yml
0 → 100644
View file @
ebdb0c02
---
title
:
Fix FE API and IDE handling of '/' relative_url_root
merge_request
:
27635
author
:
type
:
fixed
spec/javascripts/api_spec.js
View file @
ebdb0c02
...
...
@@ -4,7 +4,7 @@ import Api from '~/api';
describe
(
'
Api
'
,
()
=>
{
const
dummyApiVersion
=
'
v3000
'
;
const
dummyUrlRoot
=
'
http://host.invalid
'
;
const
dummyUrlRoot
=
'
/gitlab
'
;
const
dummyGon
=
{
api_version
:
dummyApiVersion
,
relative_url_root
:
dummyUrlRoot
,
...
...
@@ -32,6 +32,18 @@ describe('Api', () => {
expect
(
builtUrl
).
toEqual
(
expectedOutput
);
});
[
null
,
''
,
'
/
'
].
forEach
(
root
=>
{
it
(
`works when relative_url_root is
${
root
}
`
,
()
=>
{
window
.
gon
.
relative_url_root
=
root
;
const
input
=
'
/api/:version/foo/bar
'
;
const
expectedOutput
=
`/api/
${
dummyApiVersion
}
/foo/bar`
;
const
builtUrl
=
Api
.
buildUrl
(
input
);
expect
(
builtUrl
).
toEqual
(
expectedOutput
);
});
});
});
describe
(
'
group
'
,
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment