diff options
author | Christoph Wurst <ChristophWurst@users.noreply.github.com> | 2024-09-16 20:12:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-16 20:12:02 +0200 |
commit | cfef1cb4f09fe6828dd654b59ed3293d2224ec59 (patch) | |
tree | f5a54172a6044d39bf28561b17c9f549272ee507 | |
parent | c10a9805f806df7683f2c94032baf9ae06970893 (diff) | |
parent | df397d969ead64d34384bb25c54d32e886aa51da (diff) | |
download | nextcloud-server-cfef1cb4f09fe6828dd654b59ed3293d2224ec59.tar.gz nextcloud-server-cfef1cb4f09fe6828dd654b59ed3293d2224ec59.zip |
Merge pull request #48085 from nextcloud/backport/47924/stable28
[stable28] 🥅 — Catch MaxInstancesExceededException on calendar events
-rw-r--r-- | apps/dav/lib/CalDAV/CalDavBackend.php | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index d4516f7f4a5..4cad081b5f8 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -99,6 +99,7 @@ use Sabre\VObject\ParseException; 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; @@ -1711,6 +1712,12 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription '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) { @@ -2060,24 +2067,32 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription 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 |