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
1a56ac66
Commit
1a56ac66
authored
May 13, 2020
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Decode URI before passing to Vue Router for file listing router
Closes
https://gitlab.com/gitlab-org/gitlab/-/issues/217444
parent
b7e94f0a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
5 deletions
+43
-5
app/assets/javascripts/repository/router.js
app/assets/javascripts/repository/router.js
+16
-5
spec/features/projects/files/user_browses_files_spec.rb
spec/features/projects/files/user_browses_files_spec.rb
+27
-0
No files found.
app/assets/javascripts/repository/router.js
View file @
1a56ac66
...
...
@@ -7,17 +7,28 @@ import TreePage from './pages/tree.vue';
Vue
.
use
(
VueRouter
);
export
default
function
createRouter
(
base
,
baseRef
)
{
const
treePathRoute
=
{
component
:
TreePage
,
props
:
route
=>
({
path
:
route
.
params
.
path
?.
replace
(
/^
\/
/
,
''
)
||
'
/
'
,
}),
};
return
new
VueRouter
({
mode
:
'
history
'
,
base
:
joinPaths
(
gon
.
relative_url_root
||
''
,
base
),
routes
:
[
{
path
:
`(/-)?/tree/
${
baseRef
}
/:path*`
,
name
:
'
treePathDecoded
'
,
// Sometimes the ref needs decoding depending on how the backend sends it to us
path
:
`(/-)?/tree/
${
decodeURI
(
baseRef
)}
/:path*`
,
...
treePathRoute
,
},
{
name
:
'
treePath
'
,
component
:
TreePage
,
props
:
route
=>
({
path
:
route
.
params
.
path
?.
replace
(
/^
\/
/
,
''
)
||
'
/
'
,
}),
// Support without decoding as well just in case the ref doesn't need to be decoded
path
:
`(/-)?/tree/
${
baseRef
}
/:path*`
,
...
treePathRoute
,
},
{
path
:
'
/
'
,
...
...
spec/features/projects/files/user_browses_files_spec.rb
View file @
1a56ac66
...
...
@@ -209,6 +209,33 @@ describe "User browses files" do
end
end
context
"when browsing a `Ääh-test-utf-8` branch"
,
:js
do
before
do
project
.
repository
.
create_branch
(
'Ääh-test-utf-8'
,
project
.
repository
.
root_ref
)
visit
(
project_tree_path
(
project
,
"Ääh-test-utf-8"
))
end
it
"shows files from a repository"
do
expect
(
page
).
to
have_content
(
"VERSION"
)
.
and
have_content
(
".gitignore"
)
.
and
have_content
(
"LICENSE"
)
click_link
(
"files"
)
page
.
within
(
'.repo-breadcrumb'
)
do
expect
(
page
).
to
have_link
(
'files'
)
end
click_link
(
"html"
)
page
.
within
(
'.repo-breadcrumb'
)
do
expect
(
page
).
to
have_link
(
'html'
)
end
expect
(
page
).
to
have_link
(
'500.html'
)
end
end
context
"when browsing a `test-#` branch"
,
:js
do
before
do
project
.
repository
.
create_branch
(
'test-#'
,
project
.
repository
.
root_ref
)
...
...
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