The PROPFIND does not need to check the filesystem for the file existence,
because the list comes from the directory listing, similar as the other
parts already do it. That was highly visible with large collections (10k+ items),
causing massive delays.
Also avoid repeated stat() calls on the same path.
visit_time_ranges() reuses a single "original_duration" variable for two
unrelated purposes: the DTSTART->DUE span and the CREATED->COMPLETED span.
When a VTODO carries all four properties (a completed task, which most
clients write with CREATED and COMPLETED), the second assignment clobbers
the first, and the DTSTART/DUE branch of the rfc4791-9.9 table then
reconstructs DUE as DTSTART + (COMPLETED - CREATED).
The elif chain already implements the RFC table correctly (DTSTART/DUE
take precedence over CREATED/COMPLETED), so the CREATED/COMPLETED value
is never wanted there. Keep it in its own variable.
Effect: such a VTODO is filtered against a bogus interval, both in
calendar-query REPORT and in item.find_time_range() (the enclosing range
cached for the storage prefilter), so completed tasks go missing from -
or wrongly appear in - client results.
Co-Authored-By: Claude <noreply@anthropic.com>
httputils._serve_traversable looked up the Content-Type in the
module-level MIMETYPES/FALLBACK_MIMETYPE constants instead of the
mimetypes/fallback_mimetype parameters that serve_resource() and
serve_folder() accept and pass through. The parameters exist since the
helper was extracted for use by web plugins (33fcda7c, "Extract
httputils.serve_folder"), and the sibling parameters path_prefix and
index_file are honored, but a custom web plugin passing its own
mimetype mapping (e.g. to serve .json, .ico or .mjs files with a
correct Content-Type) silently got the built-in mapping and
application/octet-stream fallback instead.
Use the parameters for the lookup. No behavior change for the built-in
web module, which relies on the defaults.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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>
The share-by-map BDAY-to-ICS conversion builds a placeholder mapping for
the SUMMARY/DESCRIPTION/alarm templates. Each block sets the fallback
marker for its own placeholder (e.g. {nickname} -> '!nickname!', {n:f} ->
'!n:f!'), but the {fn} block wrote the empty-FN fallback to {nickname}
instead of {fn}.
As a result, for a VCARD whose FN is present but empty, a genuine
NICKNAME was overwritten with '!fn!' in the generated event, and the
{fn} placeholder never received its '!fn!' marker, so a '[{fn}|...]'
fallback in a template failed to resolve.
Assign the fallback to {fn}, matching the surrounding blocks.
Co-Authored-By: Claude <noreply@anthropic.com>