Merge pull request #33784 from nextcloud/backport/33139/stable23

[stable23] Check calendar URI length before creation
This commit is contained in:
blizzz 2022-09-27 08:27:47 +02:00 committed by GitHub
commit 067f62c647
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View 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,

View file

@ -416,6 +416,10 @@ class CardDavBackend implements BackendInterface, SyncSupport {
* @throws BadRequest
*/
public function createAddressBook($principalUri, $url, array $properties) {
if (strlen($url) > 255) {
throw new BadRequest('URI too long. Address book not created');
}
$values = [
'displayname' => null,
'description' => null,