mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 00:32:29 -04:00
fix(CalDAV): check voject exists before attempting any operation
Signed-off-by: Anna Larch <anna@nextcloud.com>
This commit is contained in:
parent
d7393f7bd8
commit
681da56912
1 changed files with 35 additions and 6 deletions
|
|
@ -45,7 +45,6 @@ use function array_map;
|
|||
use function array_merge;
|
||||
|
||||
class Manager implements IManager {
|
||||
|
||||
/**
|
||||
* @var ICalendar[] holds all registered calendars
|
||||
*/
|
||||
|
|
@ -239,12 +238,26 @@ class Manager implements IManager {
|
|||
/**
|
||||
* @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');
|
||||
|
|
@ -308,11 +321,27 @@ class Manager implements IManager {
|
|||
* @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');
|
||||
|
|
|
|||
Loading…
Reference in a new issue