This commit is contained in:
Graham Christensen 2024-09-05 14:27:37 -04:00
parent e0ac5da208
commit 6c3f3aaa10
2 changed files with 13 additions and 4 deletions

11
dist/index.js generated vendored
View file

@ -90887,7 +90887,7 @@ const external_node_dns_promises_namespaceObject = __WEBPACK_EXTERNAL_createRequ
var cache = __nccwpck_require__(6878); var cache = __nccwpck_require__(6878);
;// CONCATENATED MODULE: external "node:child_process" ;// CONCATENATED MODULE: external "node:child_process"
const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:child_process"); const external_node_child_process_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:child_process");
;// CONCATENATED MODULE: ./node_modules/.pnpm/github.com+DeterminateSystems+detsys-ts@ba6925e6787ee975f5102b50fa7c9350bfd6b3f4_ck2sk6yei7uoqbpevv6lntwyfm/node_modules/detsys-ts/dist/index.js ;// CONCATENATED MODULE: ./node_modules/.pnpm/github.com+DeterminateSystems+detsys-ts@587b7693c9842add262f500274f83458ca5ce770_6sj4em4j5br4ek4v5n2gpc224m/node_modules/detsys-ts/dist/index.js
var __defProp = Object.defineProperty; var __defProp = Object.defineProperty;
var __export = (target, all) => { var __export = (target, all) => {
for (var name in all) for (var name in all)
@ -91734,18 +91734,27 @@ async function verifyEtag(filename, expectedEtag) {
try { try {
const parsedEtag = parseEtag(expectedEtag); const parsedEtag = parseEtag(expectedEtag);
if (parsedEtag === void 0) { if (parsedEtag === void 0) {
core.info(
`Verifying etag failed: etag did not parse: ${expectedEtag}`
);
return "corrupt"; return "corrupt";
} }
const fd = await (0,promises_namespaceObject.open)(filename, "r"); const fd = await (0,promises_namespaceObject.open)(filename, "r");
let actualEtag; let actualEtag;
if (parsedEtag.chunks === void 0) { if (parsedEtag.chunks === void 0) {
core.debug(`Verifying etag with a simple md5`);
actualEtag = await calculateMd5Etag(fd); actualEtag = await calculateMd5Etag(fd);
} else { } else {
core.debug(`Verifying etag with a chunked md5 from s3`);
actualEtag = await calculateS3ChunkedEtag(fd, parsedEtag.chunks); actualEtag = await calculateS3ChunkedEtag(fd, parsedEtag.chunks);
} }
await fd.close();
if (expectedEtag === actualEtag) { if (expectedEtag === actualEtag) {
return "valid"; return "valid";
} else { } else {
core.info(
`Verifying etag failed: etag mismatch. Wanted ${expectedEtag}, got ${actualEtag}`
);
return "corrupt"; return "corrupt";
} }
} catch (e) { } catch (e) {

View file

@ -16,7 +16,7 @@ dependencies:
version: 5.1.1 version: 5.1.1
detsys-ts: detsys-ts:
specifier: github:DeterminateSystems/detsys-ts#verify-etag specifier: github:DeterminateSystems/detsys-ts#verify-etag
version: github.com/DeterminateSystems/detsys-ts/ba6925e6787ee975f5102b50fa7c9350bfd6b3f4 version: github.com/DeterminateSystems/detsys-ts/587b7693c9842add262f500274f83458ca5ce770
got: got:
specifier: ^14.3.0 specifier: ^14.3.0
version: 14.3.0 version: 14.3.0
@ -5753,10 +5753,10 @@ packages:
engines: { node: ">=10" } engines: { node: ">=10" }
dev: true dev: true
github.com/DeterminateSystems/detsys-ts/ba6925e6787ee975f5102b50fa7c9350bfd6b3f4: github.com/DeterminateSystems/detsys-ts/587b7693c9842add262f500274f83458ca5ce770:
resolution: resolution:
{ {
tarball: https://codeload.github.com/DeterminateSystems/detsys-ts/tar.gz/ba6925e6787ee975f5102b50fa7c9350bfd6b3f4, tarball: https://codeload.github.com/DeterminateSystems/detsys-ts/tar.gz/587b7693c9842add262f500274f83458ca5ce770,
} }
name: detsys-ts name: detsys-ts
version: 1.0.0 version: 1.0.0