Fix handling of non str types
@@ -178,10 +178,12 @@ def encode_graph_property_value(value):
def decode_graph_property_value(value, leave_str=False):
- if type(value) is str and value.startswith('"') and value.endswith('"'):
- value = value[1:-1]
- if type(value) is str and 'python' in value:
+ if type(value) not in (str, bytes, bytearray):
+ return value
+ if 'python' in value:
raise Exception(f'Identified malicious code in {value}')
+ if value.startswith('"') and value.endswith('"'):
+ value = value[1:-1]
if not leave_str:
if value.isnumeric():
value = int(value)
