Merge pull request #55764 from nextcloud/backport/54819/stable31
Some checks failed
Integration sqlite / changes (push) Waiting to run
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, --tags ~@large files_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, capabilities_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, collaboration_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, comments_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, dav_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, federation_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, file_conversions) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, filesdrop_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, ldap_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, openldap_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, openldap_numerical_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, remoteapi_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, setup_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, sharees_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, sharing_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, theming_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, videoverification_features) (push) Blocked by required conditions
Integration sqlite / integration-sqlite-summary (push) Blocked by required conditions
Psalm static code analysis / static-code-analysis (push) Has been cancelled
Psalm static code analysis / static-code-analysis-security (push) Has been cancelled
Psalm static code analysis / static-code-analysis-ocp (push) Has been cancelled
Psalm static code analysis / static-code-analysis-ncu (push) Has been cancelled

[stable31] fix: iMip reply from outlook.com does not contain organizer property
This commit is contained in:
Daniel 2025-10-23 22:27:59 +02:00 committed by GitHub
commit 5e1dd667cc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 88 additions and 5 deletions

View file

@ -227,6 +227,7 @@ class Manager implements IManager {
protected function handleIMip(
string $userId,
string $message,
array $options = [],
): bool {
$userUri = 'principals/users/' . $userId;
@ -258,8 +259,13 @@ class Manager implements IManager {
}
if (!isset($vEvent->ORGANIZER)) {
$this->logger->warning('iMip message event dose not contains an organizer');
return false;
// quirks mode: for Microsoft Exchange Servers use recipient as organizer if no organizer is set
if (isset($options['recipient']) && $options['recipient'] !== '') {
$vEvent->add('ORGANIZER', 'mailto:' . $options['recipient']);
} else {
$this->logger->warning('iMip message event does not contain an organizer and no recipient was provided');
return false;
}
}
if (!isset($vEvent->ATTENDEE)) {
@ -308,7 +314,8 @@ class Manager implements IManager {
return false;
}
$userId = substr($principalUri, 17);
return $this->handleIMip($userId, $calendarData);
$options = ['recipient' => $recipient];
return $this->handleIMip($userId, $calendarData, $options);
}
/**
@ -327,7 +334,8 @@ class Manager implements IManager {
return false;
}
$userId = substr($principalUri, 17);
return $this->handleIMip($userId, $calendarData);
$options = ['recipient' => $recipient];
return $this->handleIMip($userId, $calendarData, $options);
}
/**
@ -347,7 +355,8 @@ class Manager implements IManager {
return false;
}
$userId = substr($principalUri, 17);
return $this->handleIMip($userId, $calendarData);
$options = ['recipient' => $recipient];
return $this->handleIMip($userId, $calendarData, $options);
}
public function createEventBuilder(): ICalendarEventBuilder {

View file

@ -382,6 +382,80 @@ class ManagerTest extends TestCase {
$this->assertFalse($result);
}
public function testHandleImipMissingOrganizerWithRecipient(): void {
// construct mock user calendar
$userCalendar = $this->createMock(ITestCalendar::class);
$userCalendar->expects(self::once())
->method('isDeleted')
->willReturn(false);
$userCalendar->expects(self::once())
->method('isWritable')
->willReturn(true);
$userCalendar->expects(self::once())
->method('search')
->willReturn([['uri' => 'principals/user/attendee1/personal']]);
// construct mock calendar manager and returns
/** @var Manager&MockObject $manager */
$manager = $this->getMockBuilder(Manager::class)
->setConstructorArgs([
$this->coordinator,
$this->container,
$this->logger,
$this->time,
$this->secureRandom,
$this->userManager,
$this->serverFactory,
])
->onlyMethods(['getCalendarsForPrincipal'])
->getMock();
$manager->expects(self::once())
->method('getCalendarsForPrincipal')
->willReturn([$userCalendar]);
// construct parameters
$userId = 'attendee1';
$calendar = $this->vCalendar1a;
$calendar->add('METHOD', 'REQUEST');
$calendar->VEVENT->remove('ORGANIZER');
// construct user calendar returns
$userCalendar->expects(self::once())
->method('handleIMipMessage');
// test method
$result = $this->invokePrivate($manager, 'handleIMip', [$userId, $calendar->serialize(), ['recipient' => 'organizer@testing.com']]);
}
public function testHandleImipMissingOrganizerNoRecipient(): void {
// construct mock user calendar
$userCalendar = $this->createMock(ITestCalendar::class);
// construct mock calendar manager and returns
/** @var Manager&MockObject $manager */
$manager = $this->getMockBuilder(Manager::class)
->setConstructorArgs([
$this->coordinator,
$this->container,
$this->logger,
$this->time,
$this->secureRandom,
$this->userManager,
$this->serverFactory,
])
->onlyMethods(['getCalendarsForPrincipal'])
->getMock();
$manager->expects(self::once())
->method('getCalendarsForPrincipal')
->willReturn([$userCalendar]);
// construct parameters
$userId = 'attendee1';
$calendar = $this->vCalendar1a;
$calendar->add('METHOD', 'REQUEST');
$calendar->VEVENT->remove('ORGANIZER');
// Logger expects warning
$this->logger->expects($this->once())
->method('warning')
->with('iMip message event does not contain an organizer and no recipient was provided');
$result = $this->invokePrivate($manager, 'handleIMip', [$userId, $calendar->serialize(), []]);
}
public function testHandleImipWithNoUid(): void {
// construct mock user calendar
$userCalendar = $this->createMock(ITestCalendar::class);