Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable29] 🥅 — Catch MaxInstancesExceededException on calendar events #48096

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 31 additions & 16 deletions apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
use Sabre\VObject\Property;
use Sabre\VObject\Reader;
use Sabre\VObject\Recur\EventIterator;
use Sabre\VObject\Recur\MaxInstancesExceededException;
use Sabre\VObject\Recur\NoInstancesException;
use function array_column;
use function array_map;
Expand Down Expand Up @@ -1719,6 +1720,12 @@ public function calendarQuery($calendarId, array $filters, $calendarType = self:
'exception' => $ex,
]);
continue;
} catch (MaxInstancesExceededException $ex) {
$this->logger->warning('Caught max instances exceeded exception for calendar data. This usually indicates too much recurring (more than 3500) event in calendar data. Object uri: '.$row['uri'], [
'app' => 'dav',
'exception' => $ex,
]);
continue;
}

if (!$matches) {
Expand Down Expand Up @@ -2068,24 +2075,32 @@ private function searchCalendarObjects(IQueryBuilder $query, DateTimeInterface|n
continue;
}

$isValid = $this->validateFilterForObject($row, [
'name' => 'VCALENDAR',
'comp-filters' => [
[
'name' => 'VEVENT',
'comp-filters' => [],
'prop-filters' => [],
'is-not-defined' => false,
'time-range' => [
'start' => $start,
'end' => $end,
try {
$isValid = $this->validateFilterForObject($row, [
'name' => 'VCALENDAR',
'comp-filters' => [
[
'name' => 'VEVENT',
'comp-filters' => [],
'prop-filters' => [],
'is-not-defined' => false,
'time-range' => [
'start' => $start,
'end' => $end,
],
],
],
],
'prop-filters' => [],
'is-not-defined' => false,
'time-range' => null,
]);
'prop-filters' => [],
'is-not-defined' => false,
'time-range' => null,
]);
} catch (MaxInstancesExceededException $ex) {
$this->logger->warning('Caught max instances exceeded exception for calendar data. This usually indicates too much recurring (more than 3500) event in calendar data. Object uri: '.$row['uri'], [
'app' => 'dav',
'exception' => $ex,
]);
continue;
}

if (is_resource($row['calendardata'])) {
// Put the stream back to the beginning so it can be read another time
Expand Down
Loading