From b012431df0a3784e3c976c2214d2c518fdc32dee Mon Sep 17 00:00:00 2001 From: bytechunk Date: Mon, 9 Feb 2026 13:05:58 +0000 Subject: [PATCH] S3 api DeleteObject fix invalid XML (#1324) linked to #1323 Do only check element nodes when validating XML content (skip text nodes). If text nodes are skipped then the validation fails when providing formatted XML content as body of the request. Co-authored-by: frederic vroman Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1324 Co-authored-by: bytechunk Co-committed-by: bytechunk --- src/api/s3/delete.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/api/s3/delete.rs b/src/api/s3/delete.rs index 0ef1bf33..5370a1e8 100644 --- a/src/api/s3/delete.rs +++ b/src/api/s3/delete.rs @@ -132,6 +132,14 @@ fn parse_delete_objects_xml(xml: &roxmltree::Document) -> Option } for item in delete.children() { + // Only parse nodes + if !item.is_element() { + // text nodes are allowed only if they contain whitespace characters only + if !item.text()?.trim().is_empty() { + return None; + } + } + if item.has_tag_name("Object") { let key = item.children().find(|e| e.has_tag_name("Key"))?; let key_str = key.text()?;