diff --git a/lib/Trash/GroupTrashItem.php b/lib/Trash/GroupTrashItem.php index 48a7dcc84..04ae4abc7 100644 --- a/lib/Trash/GroupTrashItem.php +++ b/lib/Trash/GroupTrashItem.php @@ -21,6 +21,7 @@ namespace OCA\GroupFolders\Trash; +use OC\Files\Storage\Wrapper\Jail; use OCA\Files_Trashbin\Trash\ITrashBackend; use OCA\Files_Trashbin\Trash\TrashItem; use OCP\Files\FileInfo; @@ -53,4 +54,26 @@ public function getGroupFolderMountPoint(): string { public function getTitle(): string { return $this->getGroupFolderMountPoint() . '/' . $this->getOriginalLocation(); } + + public function getStorage() { + // get the unjailed storage, since the trash item is outside the jail + // (the internal path is also unjailed) + $groupFolderStorage = parent::getStorage(); + if ($groupFolderStorage->instanceOfStorage(Jail::class)) { + /** @var Jail $groupFolderStorage */ + return $groupFolderStorage->getUnjailedStorage(); + } + return $groupFolderStorage; + } + + public function getMtime() { + // trashbin is currently (incorrectly) assuming these to be the same + return $this->getDeletedTime(); + } + + public function getInternalPath() { + // trashbin expects the path without the deletion timestamp + $path = parent::getInternalPath(); + return rtrim($path, '.d' . $this->getDeletedTime()); + } } diff --git a/tests/stub.phpstub b/tests/stub.phpstub index 866ac0d3e..15c3ad9b4 100644 --- a/tests/stub.phpstub +++ b/tests/stub.phpstub @@ -978,6 +978,7 @@ namespace OC\Files\Storage\Wrapper{ class Jail extends Wrapper { public function getUnjailedPath(string $path): string {} + public function getUnjailedStorage(): IStorage {} } class Quota extends Wrapper {