Skip to content

Commit a5b26ea

Browse files
luka-nextcloudAndyScherzinger
authored andcommitted
fix(files_sharing): skip expiration notify for invalid share record
Signed-off-by: Luka Trovic <[email protected]> [skip ci]
1 parent 08e999c commit a5b26ea

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
@@ -26,6 +26,7 @@
2626
*/
2727
namespace OCA\Files_Sharing\Command;
2828

29+
use OCA\Files_Sharing\OrphanHelper;
2930
use OCP\AppFramework\Utility\ITimeFactory;
3031
use OCP\IDBConnection;
3132
use OCP\Notification\IManager as NotificationManager;
@@ -48,7 +49,9 @@ class ExiprationNotification extends Command {
4849
public function __construct(ITimeFactory $time,
4950
NotificationManager $notificationManager,
5051
IDBConnection $connection,
51-
ShareManager $shareManager) {
52+
ShareManager $shareManager,
53+
private OrphanHelper $orphanHelper,
54+
) {
5255
parent::__construct();
5356

5457
$this->notificationManager = $notificationManager;
@@ -80,7 +83,8 @@ public function execute(InputInterface $input, OutputInterface $output): int {
8083
foreach ($shares as $share) {
8184
if ($share->getExpirationDate() === null
8285
|| $share->getExpirationDate()->getTimestamp() < $minTime->getTimestamp()
83-
|| $share->getExpirationDate()->getTimestamp() > $maxTime->getTimestamp()) {
86+
|| $share->getExpirationDate()->getTimestamp() > $maxTime->getTimestamp()
87+
|| !$this->orphanHelper->isShareValid($share->getSharedBy(), $share->getNodeId())) {
8488
continue;
8589
}
8690

0 commit comments

Comments
 (0)