diff --git a/apps/dav/lib/CalDAV/CalendarHome.php b/apps/dav/lib/CalDAV/CalendarHome.php index b26e95befe6d9..a031a5b0455e2 100644 --- a/apps/dav/lib/CalDAV/CalendarHome.php +++ b/apps/dav/lib/CalDAV/CalendarHome.php @@ -30,6 +30,7 @@ use Sabre\CalDAV\Schedule\Outbox; use Sabre\CalDAV\Subscriptions\Subscription; use Sabre\DAV\Exception\NotFound; +use Sabre\DAV\MkCol; class CalendarHome extends \Sabre\CalDAV\CalendarHome { @@ -52,6 +53,19 @@ public function getCalDAVBackend() { return $this->caldavBackend; } + /** + * @inheritdoc + */ + function createExtendedCollection($name, MkCol $mkCol) { + $reservedNames = [BirthdayService::BIRTHDAY_CALENDAR_URI]; + + if (in_array($name, $reservedNames)) { + throw new \Sabre\Dav\Exception\MethodNotAllowed('The resource you tried to create is a reserved name'); + } + + parent::createExtendedCollection($name, $mkCol); + } + /** * @inheritdoc */