Skip to content

fix: drop empty CATEGORIES lines in vcal.fix - #773

Merged
tobixen merged 1 commit into
masterfrom
fix/drop-empty-categories
Oct 14, 2026
Merged

tobixen merged 1 commit into
masterfrom
fix/drop-empty-categories

Conversation

@tobixen

@tobixen tobixen commented Oct 14, 2026

Copy link
Copy Markdown
Member

Commit message:

The icalendar library inserts an empty CATEGORIES property when
component.categories is read on a component without one
(https://github.com/collective/icalendar/issues/1722).  Saved after
that, tasks end up with "CATEGORIES:" next to the real CATEGORIES
line.  vcal.fix() now drops such empty lines on load, as a temporary
workaround until the upstream bug is fixed.  Data saved from an
icalendar instance is not cleaned on save; it is cleaned the next
time it is loaded.

The warning logged on any fixup no longer blames the server: broken
data may come from the server, the client or a library in between.

Prompt: (...) The empty CATEGORIES-lines comes from a weird bug in the icalendar library, _reading_ `foo.categories` will silently insert the new line, it's filed upstream and workarounds have been made in the icalendar-searcher library, but I'm concerned it may crop up other places too, so we may need some auto-cleaning-script for this, as well as a workaround in the vcal.fix function under ~/caldav. (...)

Prompts (comments made inline in the document while reviewing it):
> (on the fixup warning blaming the calendar server) Any broken icalendar data may be due to the server breaking the standard, some the client breaking it and the server opting for round-trip preservation rather than cleanup, or some arbitrary library in between breaking things.  We should keep a WARNING in place when we clean up broken icalendar data regardless of what we're cleaning, but we should refrain from participating in any blame-game
> (on the write path not being cleaned on save) Cleanup on save is not something going into 3.5.0.  Fix the message to point this out, but also file an issue so that we can do fixups on save later.

Assisted-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Reviewed-by: Tobias Brox <tobias@redpill-linpro.com>

The icalendar library inserts an empty CATEGORIES property when
component.categories is read on a component without one
(collective/icalendar#1722).  Saved after
that, tasks end up with "CATEGORIES:" next to the real CATEGORIES
line.  vcal.fix() now drops such empty lines on load, as a temporary
workaround until the upstream bug is fixed.  Data saved from an
icalendar instance is not cleaned on save; it is cleaned the next
time it is loaded.

The warning logged on any fixup no longer blames the server: broken
data may come from the server, the client or a library in between.

Prompt: (...) The empty CATEGORIES-lines comes from a weird bug in the icalendar library, _reading_ `foo.categories` will silently insert the new line, it's filed upstream and workarounds have been made in the icalendar-searcher library, but I'm concerned it may crop up other places too, so we may need some auto-cleaning-script for this, as well as a workaround in the vcal.fix function under ~/caldav. (...)

Prompts (comments made inline in the document while reviewing it):
> (on the fixup warning blaming the calendar server) Any broken icalendar data may be due to the server breaking the standard, some the client breaking it and the server opting for round-trip preservation rather than cleanup, or some arbitrary library in between breaking things.  We should keep a WARNING in place when we clean up broken icalendar data regardless of what we're cleaning, but we should refrain from participating in any blame-game
> (on the write path not being cleaned on save) Cleanup on save is not something going into 3.5.0.  Fix the message to point this out, but also file an issue so that we can do fixups on save later.

Assisted-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Reviewed-by: Tobias Brox <tobias@redpill-linpro.com>
@tobixen
tobixen merged commit 937aae1 into master Oct 14, 2026
18 checks passed
@tobixen
tobixen deleted the fix/drop-empty-categories branch October 14, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant