From a980541c7300001181a25c2ed80401766d3abcaa Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Fri, 6 Feb 2026 10:15:08 -0600 Subject: fix(calendar-sync): sanitize description text to prevent org heading corruption Event descriptions containing lines starting with * were being interpreted as org headings, breaking file structure. Replace leading asterisks with dashes before writing descriptions. --- tests/test-calendar-sync--event-to-org.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'tests/test-calendar-sync--event-to-org.el') diff --git a/tests/test-calendar-sync--event-to-org.el b/tests/test-calendar-sync--event-to-org.el index 96ce49d5..a3dc0106 100644 --- a/tests/test-calendar-sync--event-to-org.el +++ b/tests/test-calendar-sync--event-to-org.el @@ -92,7 +92,7 @@ (should (string-match-p ":END:" result))))) (ert-deftest test-calendar-sync--event-to-org-boundary-description-with-asterisks () - "Test event description containing org-special asterisks." + "Test event description containing org-special asterisks are sanitized." (let* ((start (test-calendar-sync-time-days-from-now 5 14 0)) (end (test-calendar-sync-time-days-from-now 5 15 0)) (event (list :summary "Meeting" @@ -100,8 +100,13 @@ :end end :description "* agenda item 1\n** sub-item"))) (let ((result (calendar-sync--event-to-org event))) - ;; Description should be present - (should (string-match-p "agenda item" result))))) + ;; Description content should be present + (should (string-match-p "agenda item" result)) + ;; Leading asterisks replaced with dashes to prevent org heading conflicts + (should (string-match-p "^- agenda item 1" result)) + (should (string-match-p "^-- sub-item" result)) + ;; Only the event heading should use * + (should (= 1 (length (split-string result "^\\* " t))))))) (ert-deftest test-calendar-sync--event-to-org-boundary-organizer-email-only () "Test organizer without CN shows email." -- cgit v1.2.3