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
a8c3cc80
Commit
a8c3cc80
authored
Jul 24, 2020
by
Martin Wortschack
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '231347-sanitize-suite-endpoint-path' into 'master'
Encode suite name See merge request gitlab-org/gitlab!37727
parents
1286ebfb
2e01fc5c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
1 deletion
+33
-1
app/assets/javascripts/pipelines/stores/test_reports/actions.js
...sets/javascripts/pipelines/stores/test_reports/actions.js
+4
-1
spec/frontend/pipelines/test_reports/stores/actions_spec.js
spec/frontend/pipelines/test_reports/stores/actions_spec.js
+29
-0
No files found.
app/assets/javascripts/pipelines/stores/test_reports/actions.js
View file @
a8c3cc80
...
...
@@ -45,7 +45,10 @@ export const fetchTestSuite = ({ state, commit, dispatch }, index) => {
const
{
name
=
''
,
build_ids
=
[]
}
=
state
.
testReports
?.
test_suites
?.[
index
]
||
{};
// Replacing `/:suite_name.json` with the name of the suite. Including the extra characters
// to ensure that we replace exactly the template part of the URL string
const
endpoint
=
state
.
suiteEndpoint
?.
replace
(
'
/:suite_name.json
'
,
`/
${
name
}
.json`
);
const
endpoint
=
state
.
suiteEndpoint
?.
replace
(
'
/:suite_name.json
'
,
`/
${
encodeURIComponent
(
name
)}
.json`
,
);
return
axios
.
get
(
endpoint
,
{
params
:
{
build_ids
}
})
...
...
spec/frontend/pipelines/test_reports/stores/actions_spec.js
View file @
a8c3cc80
...
...
@@ -159,6 +159,35 @@ describe('Actions TestReports Store', () => {
testAction
(
actions
.
fetchTestSuite
,
index
,
{
...
state
,
testReports
},
[],
[],
done
);
});
});
describe
(
'
when the suite name has a `/` in it
'
,
()
=>
{
it
(
'
sets test suite, shows tests, and encodes the suite name
'
,
done
=>
{
const
index
=
0
;
const
suite
=
testReports
.
test_suites
[
0
];
const
{
name
}
=
suite
;
const
slashName
=
`
${
name
}
/8`
;
testReports
.
test_suites
[
0
].
name
=
slashName
;
const
buildIds
=
[
1
];
testReports
.
test_suites
[
0
].
hasFullSuite
=
false
;
testReports
.
test_suites
[
0
].
build_ids
=
buildIds
;
const
endpoint
=
suiteEndpoint
.
replace
(
'
:suite_name
'
,
encodeURIComponent
(
slashName
));
mock
.
onGet
(
endpoint
,
{
params
:
{
build_ids
:
buildIds
}
})
.
replyOnce
(
200
,
testReports
.
test_suites
[
0
],
{});
testAction
(
actions
.
fetchTestSuite
,
index
,
{
...
state
,
testReports
},
[{
type
:
types
.
SET_SUITE
,
payload
:
{
suite
,
index
}
}],
[{
type
:
'
toggleLoading
'
},
{
type
:
'
toggleLoading
'
}],
()
=>
{
expect
(
mock
.
history
.
get
.
map
(
x
=>
x
.
url
)).
toEqual
([
endpoint
]);
done
();
},
);
});
});
});
describe
(
'
fetch full report
'
,
()
=>
{
...
...
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