diff options
author | Richard Steinmetz <richard@steinmetz.cloud> | 2024-06-20 15:44:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-20 15:44:34 +0200 |
commit | efe3244acfe57b4286c340b169962e60628faf63 (patch) | |
tree | b2f13a7314ae932a59d14d958b9423f794c6f50b /apps/dav/tests/unit | |
parent | 8ac9e08f2086aa95a9b9423fbef3dc21814c012b (diff) | |
parent | df28c04a8f49dca0454169ad3c11b84b092dc8ff (diff) | |
download | nextcloud-server-efe3244acfe57b4286c340b169962e60628faf63.tar.gz nextcloud-server-efe3244acfe57b4286c340b169962e60628faf63.zip |
Merge pull request #45999 from nextcloud/fix/caldav/shared-calendars-activity-umlauts
fix(caldav): encode calendar URIs with umlauts for activities
Diffstat (limited to 'apps/dav/tests/unit')
-rw-r--r-- | apps/dav/tests/unit/CalDAV/Activity/Provider/EventTest.php | 53 |
1 files changed, 47 insertions, 6 deletions
diff --git a/apps/dav/tests/unit/CalDAV/Activity/Provider/EventTest.php b/apps/dav/tests/unit/CalDAV/Activity/Provider/EventTest.php index b0b2cc936a5..ec237825731 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Provider/EventTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Provider/EventTest.php @@ -129,17 +129,58 @@ class EventTest extends TestCase { $this->assertEquals($result, $this->invokePrivate($this->provider, 'generateObjectParameter', [$objectParameter, $affectedUser])); } - public function testGenerateObjectParameterWithSharedCalendar(): void { - $link = [ - 'object_uri' => 'someuuid.ics', - 'calendar_uri' => 'personal', - 'owner' => 'sharer' + public static function generateObjectParameterLinkEncodingDataProvider(): array { + return [ + [ // Shared calendar + [ + 'object_uri' => 'someuuid.ics', + 'calendar_uri' => 'personal', + 'owner' => 'sharer' + ], + base64_encode('/remote.php/dav/calendars/sharee/personal_shared_by_sharer/someuuid.ics'), + ], + [ // Shared calendar with umlauts + [ + 'object_uri' => 'someuuid.ics', + 'calendar_uri' => 'umlaut_äüöß', + 'owner' => 'sharer' + ], + base64_encode('/remote.php/dav/calendars/sharee/umlaut_%c3%a4%c3%bc%c3%b6%c3%9f_shared_by_sharer/someuuid.ics'), + ], + [ // Shared calendar with umlauts and mixed casing + [ + 'object_uri' => 'someuuid.ics', + 'calendar_uri' => 'Umlaut_äüöß', + 'owner' => 'sharer' + ], + base64_encode('/remote.php/dav/calendars/sharee/Umlaut_%c3%a4%c3%bc%c3%b6%c3%9f_shared_by_sharer/someuuid.ics'), + ], + [ // Owned calendar with umlauts + [ + 'object_uri' => 'someuuid.ics', + 'calendar_uri' => 'umlaut_äüöß', + 'owner' => 'sharee' + ], + base64_encode('/remote.php/dav/calendars/sharee/umlaut_%c3%a4%c3%bc%c3%b6%c3%9f/someuuid.ics'), + ], + [ // Owned calendar with umlauts and mixed casing + [ + 'object_uri' => 'someuuid.ics', + 'calendar_uri' => 'Umlaut_äüöß', + 'owner' => 'sharee' + ], + base64_encode('/remote.php/dav/calendars/sharee/Umlaut_%c3%a4%c3%bc%c3%b6%c3%9f/someuuid.ics'), + ], ]; + } + + /** @dataProvider generateObjectParameterLinkEncodingDataProvider */ + public function testGenerateObjectParameterLinkEncoding(array $link, string $objectId): void { $generatedLink = [ 'view' => 'dayGridMonth', 'timeRange' => 'now', 'mode' => 'sidebar', - 'objectId' => base64_encode('/remote.php/dav/calendars/sharee/' . $link['calendar_uri'] . '_shared_by_sharer/' . $link['object_uri']), + 'objectId' => $objectId, 'recurrenceId' => 'next' ]; $this->appManager->expects($this->once()) |