Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(CalDAV): check voject exists before attempting any operation
Signed-off-by: Anna Larch <[email protected]>
  • Loading branch information
miaulalala authored and backportbot-nextcloud[bot] committed Aug 29, 2023
commit 651405a320ffc597f1c68e01660ea44f56071b10
40 changes: 35 additions & 5 deletions lib/private/Calendar/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,26 @@ public function newQuery(string $principalUri): ICalendarQuery {
/**
* @throws \OCP\DB\Exception
*/
public function handleIMipReply(string $principalUri, string $sender, string $recipient, string $calendarData): bool {
/** @var VCalendar $vObject */
public function handleIMipReply(
string $principalUri,
string $sender,
string $recipient,
string $calendarData,
): bool {
/** @var VCalendar $vObject|null */
$vObject = Reader::read($calendarData);
/** @var VEvent $vEvent */

if ($vObject === null) {
return false;
}

/** @var VEvent|null $vEvent */
$vEvent = $vObject->{'VEVENT'};

if ($vEvent === null) {
return false;
}

// First, we check if the correct method is passed to us
if (strcasecmp('REPLY', $vObject->{'METHOD'}->getValue()) !== 0) {
$this->logger->warning('Wrong method provided for processing');
Expand Down Expand Up @@ -309,11 +323,27 @@ public function handleIMipReply(string $principalUri, string $sender, string $re
* @since 25.0.0
* @throws \OCP\DB\Exception
*/
public function handleIMipCancel(string $principalUri, string $sender, ?string $replyTo, string $recipient, string $calendarData): bool {
public function handleIMipCancel(
string $principalUri,
string $sender,
?string $replyTo,
string $recipient,
string $calendarData,
): bool {
/** @var VCalendar $vObject|null */
$vObject = Reader::read($calendarData);
/** @var VEvent $vEvent */

if ($vObject === null) {
return false;
}

/** @var VEvent|null $vEvent */
$vEvent = $vObject->{'VEVENT'};

if ($vEvent === null) {
return false;
}

// First, we check if the correct method is passed to us
if (strcasecmp('CANCEL', $vObject->{'METHOD'}->getValue()) !== 0) {
$this->logger->warning('Wrong method provided for processing');
Expand Down