list_objects(): fix parsing user metadata as per MinIO server (#23)

Signed-off-by: Bala.FA <bala@minio.io>
This commit is contained in:
Bala FA 2022-09-24 10:08:06 +05:30 committed by GitHub
parent 4da529a13f
commit 49452a0b73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -114,7 +114,7 @@ fn parse_list_objects_contents(
is_delete_marker: bool, is_delete_marker: bool,
) -> Result<(), Error> { ) -> Result<(), Error> {
loop { loop {
let content = match root.take_child(tag) { let mut content = match root.take_child(tag) {
Some(v) => v, Some(v) => v,
None => break, None => break,
}; };
@ -138,12 +138,15 @@ fn parse_list_objects_contents(
), ),
None => (None, None), None => (None, None),
}; };
let user_metadata = match content.get_child("UserMetadata") { let user_metadata = match content.get_mut_child("UserMetadata") {
Some(v) => { Some(v) => {
let mut map: HashMap<String, String> = HashMap::new(); let mut map: HashMap<String, String> = HashMap::new();
for node in v.children.iter() { loop {
let e = node.as_element().unwrap(); let item = match v.take_child("Items") {
map.insert(e.name.clone(), e.get_text().unwrap_or_default().to_string()); Some(v) => v,
None => break,
};
map.insert(get_text(&item, "Key")?, get_text(&item, "Value")?);
} }
Some(map) Some(map)
} }