Fix mistakenly interpreting a string as JSON for PostgreSQL AGE graph storage

This commit is contained in:
yangdx
2025-05-04 02:20:43 +08:00
parent b9b86df786
commit 1213f53fc9

View File

@@ -1252,15 +1252,7 @@ class PGGraphStorage(BaseGraphStorage):
elif dtype == "edge":
d[k] = json.loads(v)
else:
try:
d[k] = (
json.loads(v)
if isinstance(v, str)
and (v.startswith("{") or v.startswith("["))
else v
)
except json.JSONDecodeError:
d[k] = v
d[k] = v # Keep as string
return d