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

🥅 — Catch MaxInstancesExceededException on calendar events #47924

Merged
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
15 changes: 15 additions & 0 deletions apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,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 @@ -1723,6 +1724,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 @@ -2072,6 +2079,7 @@ private function searchCalendarObjects(IQueryBuilder $query, DateTimeInterface|n
continue;
}

try {
$isValid = $this->validateFilterForObject($row, [
'name' => 'VCALENDAR',
'comp-filters' => [
Expand All @@ -2090,6 +2098,13 @@ private function searchCalendarObjects(IQueryBuilder $query, DateTimeInterface|n
'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