diff options
author | Christoph Wurst <ChristophWurst@users.noreply.github.com> | 2024-07-18 10:16:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-18 10:16:05 +0200 |
commit | 1de5adf867b46bf713ac6de4b92c53aee1bf15af (patch) | |
tree | b25d695d358aeff712e2de435a7a99585bf8185b /apps/dav | |
parent | 4ad211bfa73f0a608155127f08af05e50efc032c (diff) | |
parent | 0f3d05afea9224d38ef90eba55371372f9ce9b4d (diff) | |
download | nextcloud-server-1de5adf867b46bf713ac6de4b92c53aee1bf15af.tar.gz nextcloud-server-1de5adf867b46bf713ac6de4b92c53aee1bf15af.zip |
Merge pull request #46593 from nextcloud/fix/issue-30514
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 cc6c4344c3c..d25276fe16d 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -65,6 +65,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; @@ -2987,7 +2988,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()) { |