in source/checksum/lib/validation/index.js [268:297]
async bestGuessSHA1() {
/* try tag first */
const chksum = this.tags.find(x => x.Key === this.getChecksumTagName());
if (chksum && chksum.Value.match(/^([0-9a-fA-F]{40})$/)) {
this.comparedWith = 'object-tagging';
return chksum.Value;
}
const params = {
Bucket: this.bucket,
Key: this.key,
};
const s3 = new AWS.S3({
apiVersion: '2006-03-01',
signatureVersion: 'v4',
customUserAgent: process.env.ENV_CUSTOM_USER_AGENT,
});
const {
Metadata = {},
} = await s3.headObject(params).promise();
/* try x-amz-meta-sha1 metadata */
if (Metadata.sha1) {
this.comparedWith = 'object-metadata';
return Metadata.sha1;
}
return undefined;
}