Skip to content

Commit b141736

Browse files
committed
fix: sanitize json tag input as strings
1 parent d34361b commit b141736

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/tagstudio/core/macro_parser.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,12 @@ def _import_data(table: dict[str, Any], table_key: str, filepath: Path) -> list[
356356
else:
357357
# If no delimiter is provided, assume the string is a single tag
358358
tag_strings.append(content_value)
359+
elif isinstance(content_value, bool):
360+
tag_strings = [str(content_value)]
361+
elif isinstance(content_value, list):
362+
tag_strings = [str(v) for v in content_value] # pyright: ignore[reportUnknownVariableType]
359363
else:
360-
tag_strings = deepcopy(content_value)
364+
tag_strings = deepcopy([content_value])
361365

362366
# Remove a prefix (if given) from all tags strings (if any)
363367
prefix = str(obj.get(PREFIX, ""))

0 commit comments

Comments
 (0)