Browse Source

ArrayOfLtree: fix handling of "null" string value

If a topic tag is set to "null", the data in the column will have double
quotes around it (to distinguish it from an actual null value). This
wasn't being handled and would cause a crash when trying to parse the
value.
master
Deimos 1 week ago
parent
commit
51a456bcf9
  1. 5
      tildes/tildes/lib/database.py

5
tildes/tildes/lib/database.py

@ -118,6 +118,11 @@ class ArrayOfLtree(ARRAY):
if not value:
return []
# the only case where there might be an escaped item (surrounded by double
# quotes) is the string "null" - all other causes of escaping aren't valid
# for ltree values
value = value.replace('"null"', "null")
return value.split(",")
def process(value: Optional[str]) -> Optional[list[str]]:

Loading…
Cancel
Save