]> 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)
committerAnna Larch <anna@nextcloud.com>
Thu, 15 Sep 2022 11:59:15 +0000 (13:59 +0200)
Signed-off-by: Anna Larch <anna@nextcloud.com>
apps/dav/lib/CalDAV/CalDavBackend.php

index b2a902a3b225f150d122313cd9dff4373fba6a49..76b04636f3a4e4d126fb5e8bc8a8bf55a16d71b1 100644 (file)
@@ -63,6 +63,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\QueryBuilder\IQueryBuilder;
 use OCP\EventDispatcher\IEventDispatcher;
 use OCP\IConfig;
@@ -793,8 +794,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,