Skip to content

Commit 41fa057

Browse files
committed
Hash event UID to make sure it's not too long for PushProvider
notifications Signed-off-by: Thomas Citharel <tcit@tcit.fr>
1 parent 7b5072a commit 41fa057

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,17 @@ public function send(VEvent $vevent,
9393

9494
$eventDetails = $this->extractEventDetails($vevent);
9595
$eventDetails['calendar_displayname'] = $calendarDisplayName;
96+
$eventUUID = (string) $vevent->UID;
97+
// Empty Notification ObjectId will be catched by OC\Notification\Notification
98+
$eventUUIDHash = $eventUUID ? hash('sha256', $eventUUID, false) : '';
9699

97100
foreach($users as $user) {
98101
/** @var INotification $notification */
99102
$notification = $this->manager->createNotification();
100103
$notification->setApp(Application::APP_ID)
101104
->setUser($user->getUID())
102105
->setDateTime($this->timeFactory->getDateTime())
103-
->setObject(Application::APP_ID, (string) $vevent->UID)
106+
->setObject(Application::APP_ID, $eventUUIDHash)
104107
->setSubject('calendar_reminder', [
105108
'title' => $eventDetails['title'],
106109
'start_atom' => $eventDetails['start_atom']

apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/PushProviderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ private function createNotificationMock(string $uid, \DateTime $dt):INotificatio
189189

190190
$notification->expects($this->once())
191191
->method('setObject')
192-
->with('dav', 'uid1234')
192+
->with('dav', hash('sha256', 'uid1234', false))
193193
->willReturn($notification);
194194

195195
$notification->expects($this->once())

0 commit comments

Comments
 (0)