Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
avantgardnerio committed Dec 4, 2024
1 parent 2425826 commit ba9e11c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions object_store/src/aws/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ use std::sync::Arc;
const VERSION_HEADER: &str = "x-amz-version-id";
const SHA256_CHECKSUM: &str = "x-amz-checksum-sha256";
const USER_DEFINED_METADATA_HEADER_PREFIX: &str = "x-amz-meta-";
const ALGORITHM: &str = "x-amz-checksum-algorithm";

/// A specialized `Error` for object store-related errors
#[derive(Debug, Snafu)]
Expand Down Expand Up @@ -390,10 +391,9 @@ impl<'a> Request<'a> {
let payload_sha256 = sha256.finish();

if let Some(Checksum::SHA256) = self.config.checksum {
self.builder = self.builder.header(
"x-amz-checksum-sha256",
BASE64_STANDARD.encode(payload_sha256),
);
self.builder = self
.builder
.header(SHA256_CHECKSUM, BASE64_STANDARD.encode(payload_sha256));
}
self.payload_sha256 = Some(payload_sha256);
}
Expand Down Expand Up @@ -617,11 +617,11 @@ impl S3Client {
location: &Path,
opts: PutMultipartOpts,
) -> Result<MultipartId> {
let mut req = self.request(Method::POST, location);
if self.config.checksum == Some(Checksum::SHA256) {
req = req.header("x-amz-checksum-algorithm", "SHA256");
let mut reqquest = self.request(Method::POST, location);
if let Some(algorithm) = self.config.checksum {
reqquest = reqquest.header(ALGORITHM, &algorithm.to_string().to_uppercase());
}
let response = req
let response = reqquest
.query(&[("uploads", "")])
.with_encryption_headers()
.with_attributes(opts.attributes)
Expand Down Expand Up @@ -674,7 +674,7 @@ impl S3Client {
let response = request.send().await?;
let checksum = response
.headers()
.get("x-amz-checksum-sha256")
.get(SHA256_CHECKSUM)
.and_then(|v| v.to_str().ok())
.map(|v| v.to_string());

Expand Down

0 comments on commit ba9e11c

Please sign in to comment.