mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-07-26 07:58:14 +00:00
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:
@@ -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()?;
|
||||
|
||||
Reference in New Issue
Block a user