Fix: free-busy REPORT always fails when max_freebusy_occurrence is 0

free_busy_report() explicitly handles [reporting] max_freebusy_occurrence = 0
as "limit disabled" when fetching occurrences (n=0 lets time_range_fill
return all occurrences), but the subsequent limit check
'len(occurrences) >= max_occurrence' is trivially true for
max_occurrence == 0, so every free-busy query on a non-empty calendar
raised ValueError ("FREEBUSY occurrences limit of 0 hit") and was
answered with HTTP 400.

Skip the limit check when the limit is disabled, consistent with how
xml_report() treats the same setting ('if max_occurrence and ...').
Behavior for positive limits is unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
TowyTowy
2026-07-17 01:06:51 +02:00
parent 8d76bdde43
commit f38688456d
3 changed files with 14 additions and 1 deletions

View File

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