Skip to content

Commit f8bd676

Browse files
Merge pull request #39689 from nextcloud/bugfix/39135/remove-share-notifications-for-deleted-nodes
fix(notifications): Remove share notification when the node is deleted
2 parents 149ddf4 + c3acd03 commit f8bd676

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

apps/files_sharing/lib/Notification/Notifier.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
namespace OCA\Files_Sharing\Notification;
3030

3131
use OCP\Files\IRootFolder;
32+
use OCP\Files\NotFoundException;
3233
use OCP\IGroupManager;
3334
use OCP\IL10N;
3435
use OCP\IURLGenerator;
@@ -117,6 +118,13 @@ public function prepare(INotification $notification, string $languageCode): INot
117118
throw new AlreadyProcessedException();
118119
}
119120

121+
try {
122+
$share->getNode();
123+
} catch (NotFoundException $e) {
124+
// Node is already deleted, so discard the notification
125+
throw new AlreadyProcessedException();
126+
}
127+
120128
if ($notification->getSubject() === 'expiresTomorrow') {
121129
$notification = $this->parseShareExpiration($share, $notification, $l);
122130
} else {

0 commit comments

Comments
 (0)