From 51a456bcf9119fba7aa3a0f42fca7febac474879 Mon Sep 17 00:00:00 2001 From: Deimos Date: Fri, 28 Feb 2025 13:26:28 -0700 Subject: [PATCH] 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. --- tildes/tildes/lib/database.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tildes/tildes/lib/database.py b/tildes/tildes/lib/database.py index e3d17bc..8059ec7 100644 --- a/tildes/tildes/lib/database.py +++ b/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]]: