Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamc committed Sep 5, 2024
1 parent b40256e commit 587b769
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
8 changes: 8 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions src/s3-md5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,20 @@ export async function verifyEtag(
try {
const parsedEtag = parseEtag(expectedEtag);
if (parsedEtag === undefined) {
actionsCore.info(
`Verifying etag failed: etag did not parse: ${expectedEtag}`,
);
return "corrupt";
}

const fd = await open(filename, "r");

let actualEtag: string;
if (parsedEtag.chunks === undefined) {
actionsCore.debug(`Verifying etag with a simple md5`);
actualEtag = await calculateMd5Etag(fd);
} else {
actionsCore.debug(`Verifying etag with a chunked md5 from s3`);
actualEtag = await calculateS3ChunkedEtag(fd, parsedEtag.chunks);
}

Expand All @@ -61,6 +66,9 @@ export async function verifyEtag(
if (expectedEtag === actualEtag) {
return "valid";
} else {
actionsCore.info(
`Verifying etag failed: etag mismatch. Wanted ${expectedEtag}, got ${actualEtag}`,
);
return "corrupt";
}
} catch (e: unknown) {
Expand Down

0 comments on commit 587b769

Please sign in to comment.