fix(sidebar): don't crash on a calendar without a color #8
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
public/kal!8
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/sidebar-empty-color"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
kal crashed at startup on the mba (2026-11-18) right after vdirsyncer brought in the new "Work (Swissblock)" calendar (the PA's mirror of the Swissblock Google calendar):
engine.calendar_colors()maps a calendar without a vdircolorfile to"", and the sidebar usedself._colors.get(cal, "#c0caf5"), which only falls back for a missing key. The row became"[]●[/]".or DEFAULT_COLOR, asviews/agenda.pyandviews/week.pyalready do.textual.markup.escape), so a[in a name is shown as text instead of being parsed as markup.Test:
tests/test_sidebar_colors.pymounts the sidebar with a colorless "Work (Swissblock)" and an "odd [x] name", checks both render and toggle. Full suite: 368 passed; ruff clean.Workaround until this is installed:
echo '#7aa2f7' > ~/.calendars/work-swissblock/color.🤖 Generated with Claude Code
A calendar whose vdir has no `color` file maps to "" in calendar_colors(), and `.get(cal, default)` only falls back for a missing key, so the row became "[]●[/]" and kal died at startup with MarkupError ("auto closing tag ('[/]') has nothing to close"). Hit on 2026-11-18 by the new "Work (Swissblock)" calendar. Fall back with `or`, like the agenda and week views do, and escape calendar names so a "[" in a name is text, not markup. Co-Authored-By: Claude Opus 5.5 <[email protected]>