Conversation
| .filter(|(source, _)| present_filenames.contains(*source)) | ||
| .map(|(_, dest)| dest) |
There was a problem hiding this comment.
Should this be filter_map?
| // we can supply a content checksum on every PUT. S3 will reject the upload if | ||
| // the data it receives does not match, guarding against silent corruption. | ||
| // In dry-run mode we skip reading the file entirely so the command can still be | ||
| // used to validate naming and missing-artifact handling on a fresh dist/. |
There was a problem hiding this comment.
| // used to validate naming and missing-artifact handling on a fresh dist/. | |
| // used to validate naming and missing-artifact handling on a fresh dist. |
| let shasums_sha256 = shasums_content.as_ref().map(|content| { | ||
| let mut hasher = Sha256::new(); | ||
| hasher.update(content.as_bytes()); | ||
| Sha256Sum::from_bytes(hasher.finalize().into()) | ||
| }); |
There was a problem hiding this comment.
Sha256Sum::from_content seems like a reasonable helper
|
|
||
| if let Some(digest) = sha256 { | ||
| req = req.checksum_sha256(digest.to_base64()); | ||
| } |
There was a problem hiding this comment.
File files where we don't have the checksum precomputed, we can compute it here (we have the file locally). This will prevent a file from getting corrupted during upload.
i.e. I would always send the SHA-256 to the S3 API.
There was a problem hiding this comment.
None is only used for dry-run, I'm not sure we should bother computing it there (though I agree it'd be nice not to use an Option and have a footgun)
There was a problem hiding this comment.
I can add a guard that only let's it be null during dry-run, in the above branch where we early exit.
No description provided.