emersion / go-webdav

A Go library for WebDAV, CalDAV and CardDAV
MIT License
314 stars 66 forks source link

caldav: fix match on open time ranges #139

Closed bitfehler closed 7 months ago

bitfehler commented 7 months ago

Matches on open time ranges (i.e. no end date) were not properly handled, as end is simply the zero time, which confuses the .Before() and .After() logic employed here.

This commit fixes that by adding the appropriate .IsZero() checks and also adds a test case.

The current behavior unfortunately broke compatibility with DAVx5, which by default queries only events less than 90 days ago (by using an open time range).

emersion commented 7 months ago

Should we do the same in matchPropTimeRange?

bitfehler commented 7 months ago

Good point, added there as well, and removed the TODOs about infinity, because this is exactly that

emersion commented 7 months ago

Also it seems like matchPropFilter ignores filter.TextMatch when Start is defined, not sure this is the correct behavior? But let's leave this for another patch.