]> source.dussan.org Git - nextcloud-server.git/commitdiff
Hash event UID to make sure it's not too long for PushProvider 19640/head
authorThomas Citharel <tcit@tcit.fr>
Sat, 1 Feb 2020 14:29:02 +0000 (15:29 +0100)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Tue, 25 Feb 2020 16:06:32 +0000 (16:06 +0000)
notifications

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php
apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/PushProviderTest.php

index 6e9e7831865c1615eea9a9ebca3cf9f34a229edf..6c2918efe558cbb94b3aa9578f3ab52786f37753 100644 (file)
@@ -89,6 +89,9 @@ class PushProvider extends AbstractProvider {
 
                $eventDetails = $this->extractEventDetails($vevent);
                $eventDetails['calendar_displayname'] = $calendarDisplayName;
+               $eventUUID = (string) $vevent->UID;
+               // Empty Notification ObjectId will be catched by OC\Notification\Notification
+               $eventUUIDHash = $eventUUID ? hash('sha256', $eventUUID, false) : '';
 
                foreach($users as $user) {
                        /** @var INotification $notification */
@@ -96,7 +99,7 @@ class PushProvider extends AbstractProvider {
                        $notification->setApp(Application::APP_ID)
                                ->setUser($user->getUID())
                                ->setDateTime($this->timeFactory->getDateTime())
-                               ->setObject(Application::APP_ID, (string) $vevent->UID)
+                               ->setObject(Application::APP_ID, $eventUUIDHash)
                                ->setSubject('calendar_reminder', [
                                        'title' => $eventDetails['title'],
                                        'start_atom' => $eventDetails['start_atom']
index 8bd4a660dc46187bfe27522271bc3dff76253bdc..91e0824c44edd817095d0710a5c0a4cd8bc2335b 100644 (file)
@@ -184,7 +184,7 @@ class PushProviderTest extends AbstractNotificationProviderTest {
 
                $notification->expects($this->once())
                        ->method('setObject')
-                       ->with('dav', 'uid1234')
+                       ->with('dav', hash('sha256', 'uid1234', false))
                        ->willReturn($notification);
 
                $notification->expects($this->once())