fix: strip whitespace from category names when splitting
Trim whitespace from comma-separated category values in all three methods: _create_ical_event, _merge_ical_properties, and _merge_ical_todo_properties. Prevents leading/trailing spaces in category names from inputs like "work, meeting". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
da104c59ac
commit
ec8eab99f3
@@ -651,7 +651,7 @@ class CalendarClient:
|
|||||||
# Add categories
|
# Add categories
|
||||||
categories = event_data.get("categories", "")
|
categories = event_data.get("categories", "")
|
||||||
if categories:
|
if categories:
|
||||||
event.add("categories", categories.split(","))
|
event.add("categories", [c.strip() for c in categories.split(",")])
|
||||||
|
|
||||||
# Add priority and status
|
# Add priority and status
|
||||||
priority = event_data.get("priority", 5)
|
priority = event_data.get("priority", 5)
|
||||||
@@ -816,7 +816,9 @@ class CalendarClient:
|
|||||||
if "categories" in event_data:
|
if "categories" in event_data:
|
||||||
categories_str = event_data["categories"]
|
categories_str = event_data["categories"]
|
||||||
if categories_str:
|
if categories_str:
|
||||||
component["CATEGORIES"] = categories_str.split(",")
|
component["CATEGORIES"] = [
|
||||||
|
c.strip() for c in categories_str.split(",")
|
||||||
|
]
|
||||||
elif "CATEGORIES" in component:
|
elif "CATEGORIES" in component:
|
||||||
del component["CATEGORIES"]
|
del component["CATEGORIES"]
|
||||||
|
|
||||||
@@ -1087,7 +1089,9 @@ class CalendarClient:
|
|||||||
if "categories" in todo_data:
|
if "categories" in todo_data:
|
||||||
categories_str = todo_data["categories"]
|
categories_str = todo_data["categories"]
|
||||||
if categories_str:
|
if categories_str:
|
||||||
component["CATEGORIES"] = categories_str.split(",")
|
component["CATEGORIES"] = [
|
||||||
|
c.strip() for c in categories_str.split(",")
|
||||||
|
]
|
||||||
logger.debug(f"Set CATEGORIES to {categories_str}")
|
logger.debug(f"Set CATEGORIES to {categories_str}")
|
||||||
|
|
||||||
# Update timestamps
|
# Update timestamps
|
||||||
|
|||||||
Reference in New Issue
Block a user