Fix mistakenly interpreting a string as JSON for PostgreSQL AGE graph storage
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user