From a5ce7e9cd1215f3cf78ae70bcb258e34f0d34947 Mon Sep 17 00:00:00 2001 From: NinjaCheetah <58050615+NinjaCheetah@users.noreply.github.com> Date: Sat, 27 Jul 2024 19:56:43 -0400 Subject: [PATCH] Minor fix for accepting different input types for SharedContentMap.add_content() --- src/libWiiPy/title/content.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libWiiPy/title/content.py b/src/libWiiPy/title/content.py index 424a02d..0e58046 100644 --- a/src/libWiiPy/title/content.py +++ b/src/libWiiPy/title/content.py @@ -569,7 +569,7 @@ class SharedContentMap: if type(content_hash) is bytes: # This catches the format b'GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG' if len(content_hash) == 40: - pass + content_hash_converted = content_hash # This catches the format # b'\xGG\xGG\xGG\xGG\xGG\xGG\xGG\xGG\xGG\xGG\xGG\xGG\xGG\xGG\xGG\xGG\xGG\xGG\xGG\xGG' elif len(content_hash) == 20: @@ -579,7 +579,7 @@ class SharedContentMap: raise ValueError("SHA-1 hash is not valid!") # Allow for a string like "GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG" elif type(content_hash) is str: - content_hash_converted = binascii.unhexlify(content_hash) + content_hash_converted = content_hash.encode() # If the hash isn't bytes or a string, it isn't valid and is rejected. else: raise TypeError("SHA-1 hash type is not valid! It must be either type str or bytes.")