Skip to content

Commit

Permalink
Merge pull request #46603 from nextcloud/backport/46593/stable28
Browse files Browse the repository at this point in the history
[stable28] fix(caldav): Throw 403 Forbidden Error instead of 500 Internal Server…
  • Loading branch information
SebastianKrupinski authored Jul 18, 2024
2 parents 6253c26 + 4ee1527 commit 1dd731d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
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;
Expand Down Expand Up @@ -3011,7 +3012,15 @@ public function getDenormalizedData(string $calendarData): array {
$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()) {
Expand Down

0 comments on commit 1dd731d

Please sign in to comment.