From 83ea89d85a0fa7c39fdf785218584f3d78051649 Mon Sep 17 00:00:00 2001 From: Vijay Sarvepalli Date: Thu, 22 Jan 2026 14:53:15 -0500 Subject: [PATCH 1/3] Update CSV Parser to parse_json --- docs/ssvc-calc/ssvc.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/ssvc-calc/ssvc.js b/docs/ssvc-calc/ssvc.js index 0c23ecd7..40ce4aec 100644 --- a/docs/ssvc-calc/ssvc.js +++ b/docs/ssvc-calc/ssvc.js @@ -1451,8 +1451,14 @@ function parse_file(xraw) { /* CSV or TSV looks like ID,Exploitation,Utility,TechnicalImpact,SafetyImpact,Outcome */ - var xarray = xraw.split('\n') - var xr = xarray.map(x => x.split(/[\t,]+/)) + var xarray = xraw.split('\n'); + var xr = xarray.map(function(x) { + if((x.indexOf('","') > -1) && (x[0] == '"') && (x.at(-1) == '"')){ + x = x.substr(1, x.length-2) + return x.split('","'); + } + return x.split(/[\t,]+/); + }); /* Remove first row has the headers and pass the rest to variable y */ var y = xr.splice(1) /* Check if rowID first column of second row to match not number*/ @@ -1522,8 +1528,7 @@ function parse_file(xraw) { topalert("Decision tree has been updated with "+raw.length+" nodes, with "+ y.length+" possible decisions using "+detect_version+" CSV/TSV file, You can use it now!","success") dt_clear(); - export_schema.decision_points[export_schema.decision_points.length-1]. - options.map((x,i) => lcolors[x.label] = ocolors[i] ) + parse_json(export_schema); } function add_invalid_feedback(xel,msg) { From e70f85bbecd4d4b12546fdeb301d25d643a1dae7 Mon Sep 17 00:00:00 2001 From: Vijay Sarvepalli Date: Thu, 22 Jan 2026 18:09:34 -0500 Subject: [PATCH 2/3] Bug fix for CSV/TSV importer --- docs/ssvc-calc/ssvc.js | 211 +++++++++++++++++++++++------------------ 1 file changed, 119 insertions(+), 92 deletions(-) diff --git a/docs/ssvc-calc/ssvc.js b/docs/ssvc-calc/ssvc.js index 40ce4aec..79da44e7 100644 --- a/docs/ssvc-calc/ssvc.js +++ b/docs/ssvc-calc/ssvc.js @@ -88,16 +88,16 @@ function reset_form() { $('select').prop('selectedIndex',0); $('input[type="file"]').hide(); } -function select_add_option(s,opt) { +function select_add_option(s, opt, txt) { var q = s.find('option').toArray().findIndex(function(x) { if(x.value == opt) { x.selected = true; return true; } }); if(q < 0) { - s.append($('