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 <fred@lesmouths.net>
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1324
Co-authored-by: bytechunk <bytechunk.a52b055@track-it.pw>
Co-committed-by: bytechunk <bytechunk.a52b055@track-it.pw>
This commit is contained in:
bytechunk
2026-02-09 13:05:58 +00:00
committed by Alex
parent 6e98f5e74e
commit b012431df0
+8
View File
@@ -132,6 +132,14 @@ fn parse_delete_objects_xml(xml: &roxmltree::Document) -> Option<DeleteRequest>
}
for item in delete.children() {
// Only parse <Part> 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()?;