diff options
author | Sebastian Krupinski <165827823+SebastianKrupinski@users.noreply.github.com> | 2024-07-18 18:03:41 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-18 18:03:41 -0400 |
commit | 1dd731d8930dd2f36ae8b93304b6d2a2a8e566d3 (patch) | |
tree | 14c85d95e92b8aec03d5e84e35a3437281df87cb /apps/dav | |
parent | 6253c26dff1e29317cb348661206952bd6ee5b86 (diff) | |
parent | 4ee152709e33a7f3cdf2265371a35f546ece49ca (diff) | |
download | nextcloud-server-1dd731d8930dd2f36ae8b93304b6d2a2a8e566d3.tar.gz nextcloud-server-1dd731d8930dd2f36ae8b93304b6d2a2a8e566d3.zip |
Merge pull request #46603 from nextcloud/backport/46593/stable28
[stable28] fix(caldav): Throw 403 Forbidden Error instead of 500 Internal Server…
Diffstat (limited to 'apps/dav')
-rw-r--r-- | apps/dav/lib/CalDAV/CalDavBackend.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index 218fe4fe32d..241bf802699 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\NoInstancesException; use function array_column; use function array_map; use function array_merge; @@ -3011,7 +3012,15 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $lastOccurrence = $firstOccurrence; } } else { - $it = new EventIterator($vEvents); + try { + $it = new EventIterator($vEvents); + } catch (NoInstancesException $e) { + $this->logger->debug('Caught no instance exception for calendar data. This usually indicates invalid calendar data.', [ + 'app' => 'dav', + 'exception' => $e, + ]); + throw new Forbidden($e->getMessage()); + } $maxDate = new DateTime(self::MAX_DATE); $firstOccurrence = $it->getDtStart()->getTimestamp(); if ($it->isInfinite()) { |