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
ac73df36
Commit
ac73df36
authored
Feb 06, 2020
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correctly escape special characters in Vue file listing routes
Closes
https://gitlab.com/gitlab-org/gitlab/issues/202123
parent
0f29bc50
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
39 additions
and
12 deletions
+39
-12
app/assets/javascripts/repository/components/breadcrumbs.vue
app/assets/javascripts/repository/components/breadcrumbs.vue
+3
-3
app/assets/javascripts/repository/components/table/parent_row.vue
...ts/javascripts/repository/components/table/parent_row.vue
+1
-1
app/assets/javascripts/repository/components/table/row.vue
app/assets/javascripts/repository/components/table/row.vue
+1
-1
app/assets/javascripts/repository/index.js
app/assets/javascripts/repository/index.js
+1
-1
app/assets/javascripts/repository/log_tree.js
app/assets/javascripts/repository/log_tree.js
+2
-3
spec/frontend/repository/components/breadcrumbs_spec.js
spec/frontend/repository/components/breadcrumbs_spec.js
+11
-0
spec/frontend/repository/components/table/parent_row_spec.js
spec/frontend/repository/components/table/parent_row_spec.js
+4
-3
spec/frontend/repository/components/table/row_spec.js
spec/frontend/repository/components/table/row_spec.js
+16
-0
No files found.
app/assets/javascripts/repository/components/breadcrumbs.vue
View file @
ac73df36
...
...
@@ -45,7 +45,7 @@ export default {
currentPath
:
{
type
:
String
,
required
:
false
,
default
:
'
/
'
,
default
:
''
,
},
canCollaborate
:
{
type
:
Boolean
,
...
...
@@ -107,7 +107,7 @@ export default {
return
acc
.
concat
({
name
,
path
,
to
:
`/-/tree/
${
escape
(
this
.
ref
)}${
path
}
`
,
to
:
`/-/tree/
${
escape
(
this
.
ref
)}${
escape
(
path
)
}
`
,
});
},
[
...
...
@@ -133,7 +133,7 @@ export default {
},
{
attrs
:
{
href
:
`
${
this
.
newBlobPath
}
${
this
.
currentPath
}
`
,
href
:
`
${
this
.
newBlobPath
}
/
${
this
.
currentPath
?
escape
(
this
.
currentPath
)
:
''
}
`
,
class
:
'
qa-new-file-option
'
,
},
text
:
__
(
'
New file
'
),
...
...
app/assets/javascripts/repository/components/table/parent_row.vue
View file @
ac73df36
...
...
@@ -28,7 +28,7 @@ export default {
return
splitArray
.
join
(
'
/
'
);
},
parentRoute
()
{
return
{
path
:
`/-/tree/
${
escape
(
this
.
commitRef
)}
/
${
this
.
parentPath
}
`
};
return
{
path
:
`/-/tree/
${
escape
(
this
.
commitRef
)}
/
${
escape
(
this
.
parentPath
)
}
`
};
},
},
methods
:
{
...
...
app/assets/javascripts/repository/components/table/row.vue
View file @
ac73df36
...
...
@@ -90,7 +90,7 @@ export default {
},
computed
:
{
routerLinkTo
()
{
return
this
.
isFolder
?
{
path
:
`/-/tree/
${
escape
(
this
.
ref
)}
/
${
this
.
path
}
`
}
:
null
;
return
this
.
isFolder
?
{
path
:
`/-/tree/
${
escape
(
this
.
ref
)}
/
${
escape
(
this
.
path
)
}
`
}
:
null
;
},
iconName
()
{
return
`fa-
${
getIconName
(
this
.
type
,
this
.
path
)}
`
;
...
...
app/assets/javascripts/repository/index.js
View file @
ac73df36
...
...
@@ -100,7 +100,7 @@ export default function setupVueRepositoryList() {
render
(
h
)
{
return
h
(
TreeActionLink
,
{
props
:
{
path
:
`
${
historyLink
}
/
${
this
.
$route
.
params
.
path
||
''
}
`
,
path
:
`
${
historyLink
}
/
${
this
.
$route
.
params
.
path
?
escape
(
this
.
$route
.
params
.
path
)
:
''
}
`
,
text
:
__
(
'
History
'
),
},
});
...
...
app/assets/javascripts/repository/log_tree.js
View file @
ac73df36
...
...
@@ -27,9 +27,8 @@ export function fetchLogsTree(client, path, offset, resolver = null) {
fetchpromise
=
axios
.
get
(
`
${
gon
.
relative_url_root
}
/
${
projectPath
}
/-/refs/
${
escape
(
ref
)}
/logs_tree/
${
path
.
replace
(
/^
\/
/
,
''
,
`
${
gon
.
relative_url_root
}
/
${
projectPath
}
/-/refs/
${
escape
(
ref
)}
/logs_tree/
${
escape
(
path
.
replace
(
/^
\/
/
,
''
),
)}
`
,
{
params
:
{
format
:
'
json
'
,
offset
},
...
...
spec/frontend/repository/components/breadcrumbs_spec.js
View file @
ac73df36
...
...
@@ -33,6 +33,17 @@ describe('Repository breadcrumbs component', () => {
expect
(
vm
.
findAll
(
RouterLinkStub
).
length
).
toEqual
(
linkCount
);
});
it
(
'
escapes hash in directory path
'
,
()
=>
{
factory
(
'
app/assets/javascripts#
'
);
expect
(
vm
.
findAll
(
RouterLinkStub
)
.
at
(
3
)
.
props
(
'
to
'
),
).
toEqual
(
'
/-/tree//app/assets/javascripts%23
'
);
});
it
(
'
renders last link as active
'
,
()
=>
{
factory
(
'
app/assets
'
);
...
...
spec/frontend/repository/components/table/parent_row_spec.js
View file @
ac73df36
...
...
@@ -31,9 +31,10 @@ describe('Repository parent row component', () => {
});
it
.
each
`
path | to
${
'
app
'
}
|
${
'
/-/tree/master/
'
}
${
'
app/assets
'
}
|
${
'
/-/tree/master/app
'
}
path | to
${
'
app
'
}
|
${
'
/-/tree/master/
'
}
${
'
app/assets
'
}
|
${
'
/-/tree/master/app
'
}
${
'
app/assets#/test
'
}
|
${
'
/-/tree/master/app/assets%23
'
}
`
(
'
renders link in $path to $to
'
,
({
path
,
to
})
=>
{
factory
(
path
);
...
...
spec/frontend/repository/components/table/row_spec.js
View file @
ac73df36
...
...
@@ -95,6 +95,22 @@ describe('Repository table row component', () => {
});
});
it
(
'
pushes new route for directory with hash
'
,
()
=>
{
factory
({
id
:
'
1
'
,
sha
:
'
123
'
,
path
:
'
test#
'
,
type
:
'
tree
'
,
currentPath
:
'
/
'
,
});
return
vm
.
vm
.
$nextTick
().
then
(()
=>
{
vm
.
trigger
(
'
click
'
);
expect
(
$router
.
push
).
toHaveBeenCalledWith
({
path
:
'
/-/tree/master/test%23
'
});
});
});
it
.
each
`
type | pushes
${
'
tree
'
}
|
${
true
}
...
...
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