aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav
diff options
context:
space:
mode:
authorSebastianKrupinski <krupinskis05@gmail.com>2024-07-17 15:26:05 -0400
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-07-18 08:17:13 +0000
commit9f3d07e339e728e0bd57d3bfcfdfab498cab5198 (patch)
treed38574e2edb0d8ab48112dd7fb424ae66e287c08 /apps/dav
parentebdf65a28bd8addb015c262a78de12fab3d96bc3 (diff)
downloadnextcloud-server-9f3d07e339e728e0bd57d3bfcfdfab498cab5198.tar.gz
nextcloud-server-9f3d07e339e728e0bd57d3bfcfdfab498cab5198.zip
fix(caldav): Throw 403 Forbidden Error instead of 500 Internal Server Error
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
Diffstat (limited to 'apps/dav')
-rw-r--r--apps/dav/lib/CalDAV/CalDavBackend.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php
index 58deffc1536..79e1025c5ee 100644
--- a/apps/dav/lib/CalDAV/CalDavBackend.php
+++ b/apps/dav/lib/CalDAV/CalDavBackend.php
@@ -98,6 +98,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;
@@ -3020,7 +3021,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()) {