Fix populateRunAutomationDetails for null environments

This commit is contained in:
David Verdeguer
2021-04-16 07:51:29 +02:00
parent de611b2de3
commit 0ece0d074b
3 changed files with 5 additions and 7 deletions

5
lib/upload-lib.js generated
View File

@@ -52,11 +52,10 @@ function populateRunAutomationDetails(sarifContents, analysis_key, environment)
}
let automationID = `${analysis_key}/`;
// the id has to be deterministic so we sort the fields
if (environment !== undefined) {
console.log(environment);
if (environment !== undefined && environment !== "null") {
const environmentObject = JSON.parse(environment);
for (const entry of Object.entries(environmentObject).sort()) {
automationID += `${entry[0]}:${entry[1]}/`; //automationID + entry[0] + ':' + entry[1] + '/';
automationID += `${entry[0]}:${entry[1]}/`;
}
}
const sarif = JSON.parse(sarifContents);