diff --git a/lib/Trash/GroupTrashItem.php b/lib/Trash/GroupTrashItem.php index 3e24f8375..fe4645988 100644 --- a/lib/Trash/GroupTrashItem.php +++ b/lib/Trash/GroupTrashItem.php @@ -14,6 +14,8 @@ use OCP\IUser; class GroupTrashItem extends TrashItem { + private string $internalOriginalLocation; + public function __construct( ITrashBackend $backend, string $originalLocation, @@ -24,7 +26,12 @@ public function __construct( private string $mountPoint, ?IUser $deletedBy, ) { - parent::__construct($backend, $originalLocation, $deletedTime, $trashPath, $fileInfo, $user, $deletedBy); + $this->internalOriginalLocation = $originalLocation; + parent::__construct($backend, $this->mountPoint . '/' . $originalLocation, $deletedTime, $trashPath, $fileInfo, $user, $deletedBy); + } + + public function getInternalOriginalLocation(): string { + return $this->internalOriginalLocation; } public function isRootItem(): bool { diff --git a/lib/Trash/TrashBackend.php b/lib/Trash/TrashBackend.php index 10a9adf93..7912135a6 100644 --- a/lib/Trash/TrashBackend.php +++ b/lib/Trash/TrashBackend.php @@ -80,7 +80,7 @@ public function listTrashFolder(ITrashItem $folder): array { return new GroupTrashItem( $this, - $folder->getOriginalLocation() . '/' . $node->getName(), + $folder->getInternalOriginalLocation() . '/' . $node->getName(), $folder->getDeletedTime(), $folder->getTrashPath() . '/' . $node->getName(), $node, @@ -118,7 +118,7 @@ public function restoreItem(ITrashItem $item): void { $trashStorage = $node->getStorage(); /** @var Folder $targetFolder */ $targetFolder = $this->mountProvider->getFolder((int)$folderId); - $originalLocation = $item->getOriginalLocation(); + $originalLocation = $item->getInternalOriginalLocation(); $parent = dirname($originalLocation); if ($parent === '.') { $parent = '';