Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable27] fix downloading trashbin items #2716

Merged
merged 2 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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());
}
}
1 change: 1 addition & 0 deletions tests/stub.phpstub
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading