mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
fix: [BUG] # character accumulation in markdown frontmatter tags prop (#79)
This commit is contained in:
committed by
GitHub
parent
9bff1f732e
commit
6c19c9edf5
@@ -138,15 +138,23 @@ def parse_tags(tags: Union[List[str], str, None]) -> List[str]:
|
||||
|
||||
Returns:
|
||||
A list of tag strings, or an empty list if no tags
|
||||
|
||||
Note:
|
||||
This function strips leading '#' characters from tags to prevent
|
||||
their accumulation when tags are processed multiple times.
|
||||
"""
|
||||
if tags is None:
|
||||
return []
|
||||
|
||||
# Process list of tags
|
||||
if isinstance(tags, list):
|
||||
return tags
|
||||
# First strip whitespace, then strip leading '#' characters to prevent accumulation
|
||||
return [tag.strip().lstrip('#') for tag in tags if tag and tag.strip()]
|
||||
|
||||
# Process comma-separated string of tags
|
||||
if isinstance(tags, str):
|
||||
return [tag.strip() for tag in tags.split(",") if tag.strip()]
|
||||
# Split by comma, strip whitespace, then strip leading '#' characters
|
||||
return [tag.strip().lstrip('#') for tag in tags.split(",") if tag and tag.strip()]
|
||||
|
||||
# For any other type, try to convert to string and parse
|
||||
try: # pragma: no cover
|
||||
|
||||
Reference in New Issue
Block a user