Skip to content

Commit 87e2c5b

Browse files
committed
fix(dav): expand recurrences when searching
Signed-off-by: Richard Steinmetz <[email protected]>
1 parent 09794b6 commit 87e2c5b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

apps/dav/lib/CalDAV/CalDavBackend.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* @author Thomas Citharel <[email protected]>
2121
* @author Thomas Müller <[email protected]>
2222
* @author Vinicius Cubas Brand <[email protected]>
23+
* @author Richard Steinmetz <[email protected]>
2324
*
2425
* @license AGPL-3.0
2526
*
@@ -1959,8 +1960,18 @@ public function search(array $calendarInfo, $pattern, array $searchProperties,
19591960
});
19601961
$result->closeCursor();
19611962

1962-
return array_map(function ($o) {
1963+
return array_map(function ($o) use ($options) {
19631964
$calendarData = Reader::read($o['calendardata']);
1965+
1966+
// Expand recurrences if an explicit time range is requested
1967+
if ($calendarData instanceof VCalendar
1968+
&& isset($options['timerange']['start'], $options['timerange']['end'])) {
1969+
$calendarData = $calendarData->expand(
1970+
$options['timerange']['start'],
1971+
$options['timerange']['end'],
1972+
);
1973+
}
1974+
19641975
$comps = $calendarData->getComponents();
19651976
$objects = [];
19661977
$timezones = [];

0 commit comments

Comments
 (0)