Skip to content

Commit

Permalink
Switch dependency from md5 to md-5
Browse files Browse the repository at this point in the history
md-5 seems better maintained.
  • Loading branch information
paraseba committed Feb 21, 2024
1 parent 8c881e4 commit dfe5d7f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions object_store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ reqwest = { version = "0.11", default-features = false, features = ["rustls-tls-
ring = { version = "0.17", default-features = false, features = ["std"], optional = true }
rustls-pemfile = { version = "2.0", default-features = false, features = ["std"], optional = true }
tokio = { version = "1.25.0", features = ["sync", "macros", "rt", "time", "io-util"] }
md5 = { version = "0.7.0", default-features = false, features = ["std"], optional = true }
md-5 = { version = "0.10.6", default-features = false, optional = true }

[target.'cfg(target_family="unix")'.dev-dependencies]
nix = { version = "0.27.1", features = ["fs"] }
Expand All @@ -63,7 +63,7 @@ nix = { version = "0.27.1", features = ["fs"] }
cloud = ["serde", "serde_json", "quick-xml", "hyper", "reqwest", "reqwest/json", "reqwest/stream", "chrono/serde", "base64", "rand", "ring"]
azure = ["cloud"]
gcp = ["cloud", "rustls-pemfile"]
aws = ["cloud", "md5"]
aws = ["cloud", "md-5"]
http = ["cloud"]
tls-webpki-roots = ["reqwest?/rustls-tls-webpki-roots"]

Expand Down
6 changes: 4 additions & 2 deletions object_store/src/aws/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ use bytes::{Buf, Bytes};
use hyper::http;
use hyper::http::HeaderName;
use itertools::Itertools;
use md5::{Digest, Md5};
use percent_encoding::{utf8_percent_encode, PercentEncode};
use quick_xml::events::{self as xml_events};
use reqwest::{
Expand Down Expand Up @@ -442,8 +443,9 @@ impl S3Client {
// https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObjects.html
// > "The Content-MD5 request header is required for all Multi-Object Delete requests"
// Some platforms, like MinIO, enforce this requirement and fail requests without the header.
let md5_digest = md5::compute(&body);
builder = builder.header("Content-MD5", BASE64_STANDARD.encode(md5_digest.0));
let mut hasher = Md5::new();
hasher.update(&body);
builder = builder.header("Content-MD5", BASE64_STANDARD.encode(hasher.finalize()));

let response = builder
.header(CONTENT_TYPE, "application/xml")
Expand Down

0 comments on commit dfe5d7f

Please sign in to comment.