Merge pull request #2183 from TowyTowy/fix/freebusy-unlimited-occurrence

Fix: free-busy REPORT always fails with HTTP 400 when max_freebusy_occurrence is 0
This commit is contained in:
Peter Bieringer
2026-07-17 08:45:29 +03:00
committed by GitHub
3 changed files with 14 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
# Changelog # Changelog
## 3.7.7.dev ## 3.7.7.dev
* Fix: free-busy REPORT always failed with HTTP 400 ("FREEBUSY occurrences limit of 0 hit") when [reporting] max_freebusy_occurrence is set to 0 (limit disabled), because the limit check did not honor the disabled limit
* Fix: time-range filter treated a VEVENT with a whole-day DURATION (e.g. P1D, P2D) as zero-length (timedelta.seconds instead of total_seconds), so such events were missing from calendar-query REPORT results * Fix: time-range filter treated a VEVENT with a whole-day DURATION (e.g. P1D, P2D) as zero-length (timedelta.seconds instead of total_seconds), so such events were missing from calendar-query REPORT results
* Fix: calendar-data expand (REPORT) left recurrence properties (e.g. RDATE) on the expanded single-occurrence VEVENTs; a single try/except around the sequential delattr() calls stopped at the first absent property (e.g. missing EXDATE), so later ones were never removed * Fix: calendar-data expand (REPORT) left recurrence properties (e.g. RDATE) on the expanded single-occurrence VEVENTs; a single try/except around the sequential delattr() calls stopped at the first absent property (e.g. missing EXDATE), so later ones were never removed
* Fix: text-match filter on a structured property (e.g. vCard N or ADR) crashed with HTTP 500 (AttributeError: 'Name'/'Address' object has no attribute 'lower') because vobject parses these into non-string objects; their text representation is now used * Fix: text-match filter on a structured property (e.g. vCard N or ADR) crashed with HTTP 500 (AttributeError: 'Name'/'Address' object has no attribute 'lower') because vobject parses these into non-string objects; their text representation is now used

View File

@@ -133,7 +133,7 @@ def free_busy_report(base_prefix: str, path: str, xml_request: Optional[ET.Eleme
time_range_element, time_range_element,
"VEVENT", "VEVENT",
n=n_occurrences) n=n_occurrences)
if len(occurrences) >= max_occurrence: if max_occurrence > 0 and len(occurrences) >= max_occurrence:
raise ValueError("FREEBUSY occurrences limit of {} hit" raise ValueError("FREEBUSY occurrences limit of {} hit"
.format(max_occurrence)) .format(max_occurrence))

View File

@@ -2232,6 +2232,18 @@ permissions: RrWw""")
<C:time-range start="20130901T140000Z" end="20130908T220000Z"/> <C:time-range start="20130901T140000Z" end="20130908T220000Z"/>
</C:free-busy-query>""", 400, is_xml=False) </C:free-busy-query>""", 400, is_xml=False)
# Test max_freebusy_occurrence set to 0 (limit disabled)
self.configure({"reporting": {"max_freebusy_occurrence": 0}})
code, responses = self.report(calendar_path, """\
<?xml version="1.0" encoding="utf-8" ?>
<C:free-busy-query xmlns:C="urn:ietf:params:xml:ns:caldav">
<C:time-range start="20130901T140000Z" end="20130908T220000Z"/>
</C:free-busy-query>""", 200, is_xml=False)
assert len(responses) == 1
vcalendar = list(responses.values())[0]
assert isinstance(vcalendar, vobject.base.Component)
assert len(vcalendar.vfreebusy_list) == 3
def _report_sync_token( def _report_sync_token(
self, calendar_path: str, sync_token: Optional[str] = None, **kwargs self, calendar_path: str, sync_token: Optional[str] = None, **kwargs
) -> Tuple[str, RESPONSES]: ) -> Tuple[str, RESPONSES]: