Skip to content
Permalink
Browse files

fix csv value escaping

  • Loading branch information...
phosphore committed May 21, 2019
1 parent 906f4a6 commit 04016b38970e5ca970b6788b5297f0c9dfb34555
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/util/file.js
@@ -103,10 +103,10 @@ export function writeIssues(filename, result, isSarif){
result.forEach(issue => {
issues += [
issue.id,
issue.file,
escapeCsv(issue.file),
`${issue.location.line}:${issue.location.column}`,
issue.sample,
issue.description,
escapeCsv(issue.sample),
escapeCsv(issue.description),
`https://github.com/doyensec/electronegativity/wiki/${issue.id}`
].toString();
issues += os.EOL;
@@ -118,6 +118,10 @@ export function writeIssues(filename, result, isSarif){
});
}

function escapeCsv(string) {
return '"' + string.replace(/"/g, '""') + '"';
}

export function writeCsvHeader(filename){
let header = `issue, filename, location, sample, description, url${os.EOL}`;

0 comments on commit 04016b3

Please sign in to comment.
You can’t perform that action at this time.