Skip to content

Commit

Permalink
fix: handle trailing commas (#1470)
Browse files Browse the repository at this point in the history
Signed-off-by: joseph-sentry <[email protected]>
  • Loading branch information
joseph-sentry authored Jun 10, 2024
1 parent 7b6a727 commit feaf700
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32568,7 +32568,9 @@ const buildUploadExec = () => buildExec_awaiter(void 0, void 0, void 0, function
}
if (files) {
files.split(',').map((f) => f.trim()).forEach((f) => {
uploadExecArgs.push('-f', `${f}`);
if (f.length > 0) { // this handles trailing commas
uploadExecArgs.push('-f', `${f}`);
}
});
}
if (flags) {
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/buildExec.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ test('upload args', async () => {
'exclude': 'node_modules/',
'fail_ci_if_error': 'true',
'file': 'coverage.xml',
'files': 'dir1/coverage.xml,dir2/coverage.xml',
'files': 'dir1/coverage.xml,dir2/coverage.xml,',
'flags': 'test,test2',
'git_service': 'github_enterprise',
'handle_no_reports_found': 'true',
Expand Down
4 changes: 3 additions & 1 deletion src/buildExec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,9 @@ const buildUploadExec = async (): Promise<{
}
if (files) {
files.split(',').map((f) => f.trim()).forEach((f) => {
uploadExecArgs.push('-f', `${f}`);
if (f.length > 0) { // this handles trailing commas
uploadExecArgs.push('-f', `${f}`);
}
});
}
if (flags) {
Expand Down

0 comments on commit feaf700

Please sign in to comment.