mirror of
https://github.com/astral-sh/setup-uv.git
synced 2025-04-07 07:58:48 -04:00
Only log checksum is valid when it really is (#97)
This commit is contained in:
parent
abac0ce7b0
commit
8c3a35e468
2 changed files with 10 additions and 6 deletions
6
dist/setup/index.js
generated
vendored
6
dist/setup/index.js
generated
vendored
|
@ -87930,7 +87930,7 @@ const core = __importStar(__nccwpck_require__(2186));
|
||||||
const known_checksums_1 = __nccwpck_require__(4379);
|
const known_checksums_1 = __nccwpck_require__(4379);
|
||||||
function validateChecksum(checkSum, downloadPath, arch, platform, version) {
|
function validateChecksum(checkSum, downloadPath, arch, platform, version) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let isValid = true;
|
let isValid = undefined;
|
||||||
if (checkSum !== undefined && checkSum !== "") {
|
if (checkSum !== undefined && checkSum !== "") {
|
||||||
isValid = yield validateFileCheckSum(downloadPath, checkSum);
|
isValid = yield validateFileCheckSum(downloadPath, checkSum);
|
||||||
}
|
}
|
||||||
|
@ -87946,10 +87946,12 @@ function validateChecksum(checkSum, downloadPath, arch, platform, version) {
|
||||||
core.debug(`No known checksum found for ${key}.`);
|
core.debug(`No known checksum found for ${key}.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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.`);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function validateFileCheckSum(filePath, expected) {
|
function validateFileCheckSum(filePath, expected) {
|
||||||
|
|
|
@ -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,11 +27,13 @@ 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(
|
||||||
filePath: string,
|
filePath: string,
|
||||||
|
|
Loading…
Add table
Reference in a new issue