From 841b1729d6c19bfe3dbc2f8d5850d258b02ebb74 Mon Sep 17 00:00:00 2001 From: Ruud Senden Date: Wed, 14 Sep 2022 15:17:32 +0200 Subject: [PATCH] fix: Workaround for https://github.com/actions/toolkit/issues/1179 --- dist/index.js | 10 +++++++++- src/main.ts | 11 ++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index a3766d0..f126026 100644 --- a/dist/index.js +++ b/dist/index.js @@ -10291,10 +10291,18 @@ const IS_WINDOWS = process.platform === 'win32'; function getDownloadUrl(version) { return 'https://tools.fortify.com/scancentral/Fortify_ScanCentral_Client_' + version + '_x64.zip'; } +function addExtension(filePath, extension) { + var newFilePath = filePath; + if (!filePath.endsWith(extension)) { + var newFilePath = newFilePath + extension; + fs.renameSync(filePath, newFilePath); + } + return newFilePath; +} function downloadAndExtract(url) { return __awaiter(this, void 0, void 0, function* () { core.debug("Downloading " + url); - const toolZip = yield tc.downloadTool(url); + const toolZip = addExtension(yield tc.downloadTool(url), ".zip"); core.debug("Extracting " + toolZip); const extractPath = yield tc.extractZip(toolZip); return extractPath; diff --git a/src/main.ts b/src/main.ts index 4c6583b..e86494d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -12,9 +12,18 @@ function getDownloadUrl(version: string): string { return 'https://tools.fortify.com/scancentral/Fortify_ScanCentral_Client_' + version + '_x64.zip'; } +function addExtension(filePath: string, extension: string): string { + var newFilePath = filePath; + if ( !filePath.endsWith(extension) ) { + var newFilePath = newFilePath + extension; + fs.renameSync(filePath, newFilePath); + } + return newFilePath; +} + async function downloadAndExtract(url: string): Promise { core.debug("Downloading " + url); - const toolZip = await tc.downloadTool(url); + const toolZip = addExtension(await tc.downloadTool(url), ".zip"); core.debug("Extracting " + toolZip); const extractPath = await tc.extractZip(toolZip); return extractPath;