fix: improve CalDAV sync robustness with namespace URI and error handling - #1874
Merged
alextselegidis merged 1 commit intoMay 6, 2026
Merged
Conversation
…ling
Use the CalDAV namespace URI ('urn:ietf:params:xml:ns:caldav') instead of
guessing the XML prefix when parsing calendar-data elements. The previous
approach tried 'cal', 'C', and 'c' but would fail for any server using a
different prefix. XML namespace prefixes are arbitrary — only the URI is
guaranteed, so matching by URI works with all compliant CalDAV servers.
Wrap individual event imports in a try/catch so that a single problematic
event (e.g. one failing the minimum duration validation) no longer aborts
the entire sync. Skipped events are logged for troubleshooting.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner
|
Thanks for providing this fix. -- Alex Tselegidis, Easy!Appointments Creator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two fixes to improve CalDAV sync reliability:
Use namespace URI instead of prefix for XML parsing —
parse_xml_events()previously tried a hardcoded list of prefixes ('cal','C','c') to findcalendar-dataelements. XML namespace prefixes are arbitrary — only the URI is guaranteed. This replaces the prefix-guessing with->children('urn:ietf:params:xml:ns:caldav')which works with all compliant CalDAV servers regardless of their chosen prefix. Improves on the approach in Can't import caldav events that were created with radicale #1840.Wrap individual event imports in try/catch — In
Caldav::sync(), a single event failing validation (e.g. the minimum duration check inUnavailabilities_model) would abort the entire sync. Now each event is processed independently — failures are logged and the remaining events continue syncing.Context
Discovered while syncing with Fastmail's CalDAV server, which uses
xmlns:c="urn:ietf:params:xml:ns:caldav". The'c'prefix was added in #1840 but the underlying issue remains for any server using a prefix not in the hardcoded list. The namespace URI approach is the correct solution per the XML specification.The error handling gap was discovered when a recurring calendar event expanded to a sub-5-minute instance, triggering
EVENT_MINIMUM_DURATIONvalidation and crashing the sync for all remaining events.Test plan
c)C, some usecal)EVENT_MINIMUM_DURATION— they should be skipped with a log entry, not crash the syncstorage/logs/🤖 Generated with Claude Code