From 11a1f3f6cfb23254e5bd58c0752c2d042bb94cee Mon Sep 17 00:00:00 2001 From: Jill Date: Fri, 14 Jan 2022 14:09:18 +0100 Subject: [PATCH] garage_api(fixup): Verify Content-SHA256 header for multipart upload only when needed. --- src/api/s3_put.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/api/s3_put.rs b/src/api/s3_put.rs index 9fb5b826..4e85664b 100644 --- a/src/api/s3_put.rs +++ b/src/api/s3_put.rs @@ -504,11 +504,11 @@ pub async fn handle_complete_multipart_upload( upload_id: &str, content_sha256: Option, ) -> Result, Error> { - let content_sha256 = - content_sha256.ok_or_bad_request("Request content hash not signed, aborting.")?; - let body = hyper::body::to_bytes(req.into_body()).await?; - verify_signed_content(content_sha256, &body[..])?; + + if let Some(content_sha256) = content_sha256 { + verify_signed_content(content_sha256, &body[..])?; + } let body_xml = roxmltree::Document::parse(std::str::from_utf8(&body)?)?; let body_list_of_parts = parse_complete_multpart_upload_body(&body_xml)