aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJill <kokakiwi@deuxfleurs.fr>2022-01-17 11:18:40 +0100
committerAlex <alex@adnab.me>2022-01-17 11:18:40 +0100
commitfdcddbe168f5faa89e1da22051aa5b58f85038f2 (patch)
tree637b6150dcf44b11fe07551a752c58aaba87a08a
parentb45dcc1925d76f3f7dcae7deea0391953ba548e5 (diff)
downloadgarage-fdcddbe168f5faa89e1da22051aa5b58f85038f2.tar.gz
garage-fdcddbe168f5faa89e1da22051aa5b58f85038f2.zip
Fix Multipart Upload with WinSCP (#164) (#193)
Closes #164. Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/193 Co-authored-by: Jill <kokakiwi@deuxfleurs.fr> Co-committed-by: Jill <kokakiwi@deuxfleurs.fr>
-rw-r--r--src/api/s3_put.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/api/s3_put.rs b/src/api/s3_put.rs
index 4e85664b..a3ae290d 100644
--- a/src/api/s3_put.rs
+++ b/src/api/s3_put.rs
@@ -511,7 +511,7 @@ pub async fn handle_complete_multipart_upload(
}
let body_xml = roxmltree::Document::parse(std::str::from_utf8(&body)?)?;
- let body_list_of_parts = parse_complete_multpart_upload_body(&body_xml)
+ let body_list_of_parts = parse_complete_multipart_upload_body(&body_xml)
.ok_or_bad_request("Invalid CompleteMultipartUpload XML")?;
debug!(
"CompleteMultipartUpload list of parts: {:?}",
@@ -703,7 +703,7 @@ struct CompleteMultipartUploadPart {
part_number: u64,
}
-fn parse_complete_multpart_upload_body(
+fn parse_complete_multipart_upload_body(
xml: &roxmltree::Document,
) -> Option<Vec<CompleteMultipartUploadPart>> {
let mut parts = vec![];
@@ -715,6 +715,11 @@ fn parse_complete_multpart_upload_body(
}
for item in cmu.children() {
+ // Only parse <Part> nodes
+ if !item.is_element() {
+ continue;
+ }
+
if item.has_tag_name("Part") {
let etag = item.children().find(|e| e.has_tag_name("ETag"))?.text()?;
let part_number = item