Skip to content

Commit 83e2606

Browse files
fix(files_sharing): skip expiration notify for invalid share record
Signed-off-by: Luka Trovic <[email protected]> [skip ci]
1 parent 21fd8b1 commit 83e2606

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

apps/files_sharing/lib/Command/ExiprationNotification.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99
namespace OCA\Files_Sharing\Command;
1010

11+
use OCA\Files_Sharing\OrphanHelper;
1112
use OCP\AppFramework\Utility\ITimeFactory;
1213
use OCP\IDBConnection;
1314
use OCP\Notification\IManager as NotificationManager;
@@ -30,7 +31,9 @@ class ExiprationNotification extends Command {
3031
public function __construct(ITimeFactory $time,
3132
NotificationManager $notificationManager,
3233
IDBConnection $connection,
33-
ShareManager $shareManager) {
34+
ShareManager $shareManager,
35+
private OrphanHelper $orphanHelper,
36+
) {
3437
parent::__construct();
3538

3639
$this->notificationManager = $notificationManager;
@@ -62,7 +65,8 @@ public function execute(InputInterface $input, OutputInterface $output): int {
6265
foreach ($shares as $share) {
6366
if ($share->getExpirationDate() === null
6467
|| $share->getExpirationDate()->getTimestamp() < $minTime->getTimestamp()
65-
|| $share->getExpirationDate()->getTimestamp() > $maxTime->getTimestamp()) {
68+
|| $share->getExpirationDate()->getTimestamp() > $maxTime->getTimestamp()
69+
|| !$this->orphanHelper->isShareValid($share->getSharedBy(), $share->getNodeId())) {
6670
continue;
6771
}
6872

0 commit comments

Comments
 (0)