Skip to content

Commit 3abce81

Browse files
committed
fix(backend): Don't run revertSubFolders() on collective rootfolder
Signed-off-by: Jonas <jonas@freesources.org>
1 parent 117e0e5 commit 3abce81

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/Trash/PageTrashBackend.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,11 @@ public function removeItem(ITrashItem $item): void {
214214
}
215215

216216
// Get original parent folder of item to revert subfolders further down
217-
$targetFolder = $this->collectiveFolderManager->getFolder($collectiveId);
217+
$collectiveFolder = $this->collectiveFolderManager->getFolder($collectiveId);
218218
$targetFolderPath = substr($item->getOriginalLocation(), 0, -strlen($item->getName()));
219219
if ($targetFolderPath) {
220220
try {
221-
$targetFolder = $targetFolder->get($targetFolderPath);
221+
$targetFolder = $collectiveFolder->get($targetFolderPath);
222222
} catch (NotFoundException $e) {
223223
$targetFolder = null;
224224
}
@@ -259,7 +259,7 @@ public function removeItem(ITrashItem $item): void {
259259
}
260260

261261
// Try to revert subfolders of target folder parent
262-
if ($targetFolder) {
262+
if ($targetFolder && $targetFolder->getId() !== $collectiveFolder->getId()) {
263263
try {
264264
NodeHelper::revertSubFolders($targetFolder->getParent());
265265
} catch (\OCA\Collectives\Service\NotFoundException | \OCA\Collectives\Service\NotPermittedException $e) {

0 commit comments

Comments
 (0)