Skip to content

Commit 8de39a0

Browse files
committed
fix(FileListener): Do not consider events in trashbin
Signed-off-by: Marcel Klehr <[email protected]>
1 parent 693994f commit 8de39a0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/Hooks/FileListener.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,9 @@ public function postInsert(Node $node, bool $recurse = true, ?array $mimeTypes =
266266
if ($storageId === null) {
267267
return;
268268
}
269+
if (preg_match('#^/[^/]*?/files($|/)#', $node->getPath()) !== 1 && preg_match('#^/groupfolders/#', $node->getPath()) !== 1) {
270+
return;
271+
}
269272
$this->fsActionMapper->insertCreation($storageId, $node->getId());
270273
}
271274

@@ -283,6 +286,10 @@ public function postRename(Node $source, Node $target): void {
283286
$targetOwner = $target->getOwner();
284287
$ownerId = $sourceOwner?->getUID() ?? $targetOwner?->getUID() ?? $existingUsers[0];
285288

289+
if (preg_match('#^/[^/]*?/files/#', $target->getPath()) !== 1 && preg_match('#^/groupfolders/#', $target->getPath()) !== 1) {
290+
return;
291+
}
292+
286293
$this->fsActionMapper->insertMove($target->getId(), $ownerId, $usersToAdd, $targetUserIds);
287294
}
288295

@@ -371,6 +378,10 @@ private function resetIgnoreCache(Node $node) : void {
371378
* @throws MultipleObjectsReturnedException
372379
*/
373380
private function onAccessUpdate(int $storageId, int $rootId): void {
381+
$node = $this->rootFolder->getFirstNodeById($rootId);
382+
if (!$node || (preg_match('#^/[^/]*?/files($|/)#', $node->getPath()) !== 1 && preg_match('#^/groupfolders/#', $node->getPath()) !== 1)) {
383+
return;
384+
}
374385
$this->fsActionMapper->insertAccessUpdate($storageId, $rootId);
375386
}
376387
}

0 commit comments

Comments
 (0)