Skip to content

Commit

Permalink
Check calendar URI length before creation
Browse files Browse the repository at this point in the history
Signed-off-by: Anna Larch <anna@nextcloud.com>
  • Loading branch information
miaulalala committed Jul 6, 2022
1 parent dfbfe5a commit a70335d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

use DateTime;
use DateTimeInterface;
use OC\DB\Exceptions\DbalException;
use OCA\DAV\AppInfo\Application;
use OCA\DAV\Connector\Sabre\Principal;
use OCA\DAV\DAV\Sharing\Backend;
Expand All @@ -64,6 +65,7 @@
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;
Expand Down Expand Up @@ -770,8 +772,14 @@ public function getSubscriptionById($subscriptionId) {
* @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,
Expand Down

0 comments on commit a70335d

Please sign in to comment.