Only log checksum is valid when it really is (#97)

This commit is contained in:
Kevin Stillhammer 2024-09-21 21:10:22 +02:00 committed by GitHub
parent abac0ce7b0
commit 8c3a35e468
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

BIN
dist/setup/index.js generated vendored

Binary file not shown.

View File

@ -12,7 +12,7 @@ export async function validateChecksum(
platform: Platform, platform: Platform,
version: string, version: string,
): Promise<void> { ): Promise<void> {
let isValid = true; let isValid: boolean | undefined = undefined;
if (checkSum !== undefined && checkSum !== "") { if (checkSum !== undefined && checkSum !== "") {
isValid = await validateFileCheckSum(downloadPath, checkSum); isValid = await validateFileCheckSum(downloadPath, checkSum);
} else { } else {
@ -27,10 +27,12 @@ export async function validateChecksum(
} }
} }
if (!isValid) { if (isValid === false) {
throw new Error(`Checksum for ${downloadPath} did not match ${checkSum}.`); throw new Error(`Checksum for ${downloadPath} did not match ${checkSum}.`);
} }
if (isValid === true) {
core.debug(`Checksum for ${downloadPath} is valid.`); core.debug(`Checksum for ${downloadPath} is valid.`);
}
} }
async function validateFileCheckSum( async function validateFileCheckSum(