From 2658f2515375879e3c4f19164bad1008a387bde6 Mon Sep 17 00:00:00 2001 From: Patrick Renner Date: Tue, 24 Sep 2024 12:01:42 +0200 Subject: [PATCH] make hashes lowercase on import from XML for improved robustness --- ascmhl/hashlist_xml_parser.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ascmhl/hashlist_xml_parser.py b/ascmhl/hashlist_xml_parser.py index 60ff973..848d83f 100644 --- a/ascmhl/hashlist_xml_parser.py +++ b/ascmhl/hashlist_xml_parser.py @@ -164,9 +164,14 @@ def parse(file_path): else: # find right hash entry and set structure hash entry = current_object.find_hash_entry_for_format(tag) - entry.structure_hash_string = element.text + entry.structure_hash_string = ( + element.text.lower() + ) # lower() for improved robustness for uppercase hashes in manifests (which is actually covered in the spec unambiguously) + else: - entry = MHLHashEntry(tag, element.text, element.attrib.get("action"), hash_date) + entry = MHLHashEntry( + tag, element.text.lower(), element.attrib.get("action"), hash_date + ) # lower() for improved robustness for uppercase hashes in manifests (which is actually covered in the spec unambiguously) current_object.append_hash_entry(entry) elif tag == "hash" or tag == "directoryhash":