Skip to content

Commit

Permalink
fix downloading trashbin items
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 committed Jan 3, 2024
1 parent 6b8882f commit 083cfd3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions lib/Trash/GroupTrashItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}
}

0 comments on commit 083cfd3

Please sign in to comment.