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
d67e1af4
Commit
d67e1af4
authored
Apr 09, 2020
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correctly handle slash and hash in tree URL
https://gitlab.com/gitlab-org/gitlab/-/issues/199308
parent
a14d0934
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
app/assets/javascripts/repository/router.js
app/assets/javascripts/repository/router.js
+1
-1
spec/frontend/repository/router_spec.js
spec/frontend/repository/router_spec.js
+9
-8
No files found.
app/assets/javascripts/repository/router.js
View file @
d67e1af4
...
...
@@ -12,7 +12,7 @@ export default function createRouter(base, baseRef) {
base
:
joinPaths
(
gon
.
relative_url_root
||
''
,
base
),
routes
:
[
{
path
:
`(/-)?/tree/(
${
encodeURIComponent
(
baseRef
)}
|
${
baseRef
}
)/:path*`
,
path
:
`(/-)?/tree/(
${
encodeURIComponent
(
baseRef
)
.
replace
(
/%2F/g
,
'
/
'
)
}
|
${
baseRef
}
)/:path*`
,
name
:
'
treePath
'
,
component
:
TreePage
,
props
:
route
=>
({
...
...
spec/frontend/repository/router_spec.js
View file @
d67e1af4
...
...
@@ -4,14 +4,15 @@ import createRouter from '~/repository/router';
describe
(
'
Repository router spec
'
,
()
=>
{
it
.
each
`
path | component | componentName
${
'
/
'
}
|
${
IndexPage
}
|
${
'
IndexPage
'
}
${
'
/tree/master
'
}
|
${
TreePage
}
|
${
'
TreePage
'
}
${
'
/-/tree/master
'
}
|
${
TreePage
}
|
${
'
TreePage
'
}
${
'
/-/tree/master/app/assets
'
}
|
${
TreePage
}
|
${
'
TreePage
'
}
${
'
/-/tree/123/app/assets
'
}
|
${
null
}
|
${
'
null
'
}
`
(
'
sets component as $componentName for path "$path"
'
,
({
path
,
component
})
=>
{
const
router
=
createRouter
(
''
,
'
master
'
);
path | branch | component | componentName
${
'
/
'
}
|
${
'
master
'
}
|
${
IndexPage
}
|
${
'
IndexPage
'
}
${
'
/tree/master
'
}
|
${
'
master
'
}
|
${
TreePage
}
|
${
'
TreePage
'
}
${
'
/-/tree/master
'
}
|
${
'
master
'
}
|
${
TreePage
}
|
${
'
TreePage
'
}
${
'
/-/tree/master/app/assets
'
}
|
${
'
master
'
}
|
${
TreePage
}
|
${
'
TreePage
'
}
${
'
/-/tree/feature/test-%23/app/assets
'
}
|
${
'
feature/test-#
'
}
|
${
TreePage
}
|
${
'
TreePage
'
}
${
'
/-/tree/123/app/assets
'
}
|
${
'
master
'
}
|
${
null
}
|
${
'
null
'
}
`
(
'
sets component as $componentName for path "$path"
'
,
({
path
,
component
,
branch
})
=>
{
const
router
=
createRouter
(
''
,
branch
);
const
componentsForRoute
=
router
.
getMatchedComponents
(
path
);
...
...
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