From: Thomas Citharel Date: Sat, 1 Feb 2020 14:29:02 +0000 (+0100) Subject: Hash event UID to make sure it's not too long for PushProvider X-Git-Tag: v18.0.2RC1~9^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1aba55aa6169f918063e24a960b1ccb138e3a782;p=nextcloud-server.git Hash event UID to make sure it's not too long for PushProvider notifications Signed-off-by: Thomas Citharel --- diff --git a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php index 675dc24473d..7e560159950 100644 --- a/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php +++ b/apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php @@ -93,6 +93,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 */ @@ -100,7 +103,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'] diff --git a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/PushProviderTest.php b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/PushProviderTest.php index feda4ab45ac..92ccbfb08f8 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/PushProviderTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/PushProviderTest.php @@ -189,7 +189,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())