Merge pull request #46603 from nextcloud/backport/46593/stable28

[stable28] fix(caldav): Throw 403 Forbidden Error instead of 500 Internal Server…
This commit is contained in:
Sebastian Krupinski 2024-07-18 18:03:41 -04:00 committed by GitHub
commit 1dd731d893
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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()) {