Skip to content

Commit

Permalink
list_objecst: fix parsing user metadata as per MinIO server
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana committed Sep 26, 2022
1 parent bed40f7 commit c9cfa89
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions minio/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,14 @@ def fromxml(cls, element, bucket_name, is_delete_marker=False,
else (findtext(tag, "ID"), findtext(tag, "DisplayName"))
)

tag = find(element, "UserMetadata") or []
metadata = {}
for child in tag:
key = child.tag.split("}")[1] if "}" in child.tag else child.tag
metadata[key] = child.text
selement = find(element, "UserMetadata")
if selement:
for child in findall(selement, "Items"):
key = find(child, "Key")
value = find(child, "Value")
if key and value:
metadata[key.text] = value.text

object_name = findtext(element, "Key", True)
if encoding_type == "url":
Expand Down

0 comments on commit c9cfa89

Please sign in to comment.