From eff153187b349e02ed53d14ccaf0e9d75f6dba04 Mon Sep 17 00:00:00 2001 From: Starknet Dev Date: Mon, 9 Sep 2024 10:37:25 -0400 Subject: [PATCH] add case for non decodable name --- indexer/graphql/src/indexer/graphql.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/indexer/graphql/src/indexer/graphql.py b/indexer/graphql/src/indexer/graphql.py index 0bd832731..b732656ae 100644 --- a/indexer/graphql/src/indexer/graphql.py +++ b/indexer/graphql/src/indexer/graphql.py @@ -68,9 +68,14 @@ def parse_string(value): def serialize_string(value): - # Assuming the input is a hexadecimal string - # Convert it back to bytes and then to a UTF-8 string - return bytes.fromhex(str(value)).decode("utf-8") + if value is None: + return None + try: + # Try to decode as UTF-8 + return bytes.fromhex(str(value)).decode('utf-8') + except UnicodeDecodeError: + # If UTF-8 decoding fails, return the original hexadecimal string + return str(value) def parse_class(value):