]> source.dussan.org Git - nextcloud-server.git/commitdiff
Check calendar URI length before creation
authorAnna Larch <anna@nextcloud.com>
Wed, 6 Jul 2022 17:16:38 +0000 (19:16 +0200)
committerJoas Schilling <coding@schilljs.com>
Fri, 26 Aug 2022 11:57:43 +0000 (13:57 +0200)
Signed-off-by: Anna Larch <anna@nextcloud.com>
apps/dav/lib/CalDAV/CalDavBackend.php

index 42df838523d8ea989475176c39032f0f8f42e9dd..a147d785cc747ed746007e1de1d8e50e9ab5859d 100644 (file)
@@ -64,6 +64,7 @@ use OCA\DAV\Events\CalendarUpdatedEvent;
 use OCA\DAV\Events\SubscriptionCreatedEvent;
 use OCA\DAV\Events\SubscriptionDeletedEvent;
 use OCA\DAV\Events\SubscriptionUpdatedEvent;
+use OCP\Calendar\Exceptions\CalendarException;
 use OCP\DB\Exception;
 use OCP\DB\QueryBuilder\IQueryBuilder;
 use OCP\EventDispatcher\IEventDispatcher;
@@ -770,8 +771,14 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
         * @param string $calendarUri
         * @param array $properties
         * @return int
+        *
+        * @throws CalendarException
         */
        public function createCalendar($principalUri, $calendarUri, array $properties) {
+               if (strlen($calendarUri) > 255) {
+                       throw new CalendarException('URI too long. Calendar not created');
+               }
+
                $values = [
                        'principaluri' => $this->convertPrincipal($principalUri, true),
                        'uri' => $calendarUri,