From 710606cc35e2444ba84bdf7702dcb481f7380ae7 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Fri, 24 Oct 2025 14:42:36 +0100 Subject: [PATCH] Check that `outputPath` is non-empty --- lib/analyze-action.js | 2 +- lib/upload-lib.js | 2 +- lib/upload-sarif-action.js | 2 +- src/upload-lib.ts | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/analyze-action.js b/lib/analyze-action.js index a897de825..7a8bf55fb 100644 --- a/lib/analyze-action.js +++ b/lib/analyze-action.js @@ -95936,7 +95936,7 @@ async function postProcessSarifFiles(logger, features, checkoutPath, sarifPaths, } async function writePostProcessedFiles(logger, pathInput, uploadTarget, postProcessingResults) { const outputPath = pathInput || process.env["CODEQL_ACTION_SARIF_DUMP_DIR" /* SARIF_DUMP_DIR */]; - if (outputPath !== void 0) { + if (outputPath !== void 0 && outputPath.trim() !== "") { dumpSarifFile( JSON.stringify(postProcessingResults.sarif), outputPath, diff --git a/lib/upload-lib.js b/lib/upload-lib.js index 0d35b5f27..e19467442 100644 --- a/lib/upload-lib.js +++ b/lib/upload-lib.js @@ -92750,7 +92750,7 @@ async function postProcessSarifFiles(logger, features, checkoutPath, sarifPaths, } async function writePostProcessedFiles(logger, pathInput, uploadTarget, postProcessingResults) { const outputPath = pathInput || process.env["CODEQL_ACTION_SARIF_DUMP_DIR" /* SARIF_DUMP_DIR */]; - if (outputPath !== void 0) { + if (outputPath !== void 0 && outputPath.trim() !== "") { dumpSarifFile( JSON.stringify(postProcessingResults.sarif), outputPath, diff --git a/lib/upload-sarif-action.js b/lib/upload-sarif-action.js index f11fd9e40..d91b83b42 100644 --- a/lib/upload-sarif-action.js +++ b/lib/upload-sarif-action.js @@ -93406,7 +93406,7 @@ async function postProcessSarifFiles(logger, features, checkoutPath, sarifPaths, } async function writePostProcessedFiles(logger, pathInput, uploadTarget, postProcessingResults) { const outputPath = pathInput || process.env["CODEQL_ACTION_SARIF_DUMP_DIR" /* SARIF_DUMP_DIR */]; - if (outputPath !== void 0) { + if (outputPath !== void 0 && outputPath.trim() !== "") { dumpSarifFile( JSON.stringify(postProcessingResults.sarif), outputPath, diff --git a/src/upload-lib.ts b/src/upload-lib.ts index aa8bb6176..573ca670c 100644 --- a/src/upload-lib.ts +++ b/src/upload-lib.ts @@ -776,8 +776,8 @@ export async function writePostProcessedFiles( // If there's an explicit input, use that. Otherwise, use the value from the environment variable. const outputPath = pathInput || process.env[EnvVar.SARIF_DUMP_DIR]; - // If we have an output path, write the SARIF file to it. - if (outputPath !== undefined) { + // If we have a non-empty output path, write the SARIF file to it. + if (outputPath !== undefined && outputPath.trim() !== "") { dumpSarifFile( JSON.stringify(postProcessingResults.sarif), outputPath,