Merge pull request #1512 from danielaskdd/fix-json-postgres

Fix node names with JSON formatting were mistakenly interpreted as JSON objects for PostgreSQL AGE graph storage
This commit is contained in:
Daniel.y
2025-05-04 02:29:58 +08:00
committed by GitHub

View File

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