diff options
author | Robin Appelman <robin@icewind.nl> | 2021-03-19 20:11:13 +0300 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2021-03-31 17:42:19 +0300 |
commit | 34037ef1957cb9eafd47bdc30195ff242c9a78f2 (patch) | |
tree | f215a6bd74fa9ee663164e832517353e9e192116 | |
parent | 312f804b0edb8bd126680fe76bdb22ad9a71a276 (diff) |
harden getTrashNodeById a bitharden-trashnode
hopefully prevent some error cases
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r-- | lib/Trash/TrashBackend.php | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Trash/TrashBackend.php b/lib/Trash/TrashBackend.php index f32cd72c..58d8553e 100644 --- a/lib/Trash/TrashBackend.php +++ b/lib/Trash/TrashBackend.php @@ -307,7 +307,10 @@ class TrashBackend implements ITrashBackend { } $absolutePath = $this->appFolder->getMountPoint()->getMountPoint() . $path; $relativePath = $trashFolder->getRelativePath($absolutePath); - list(, $folderId, $nameAndTime) = explode('/', $relativePath); + if (!$relativePath || strpos($relativePath, '/') === false) { + return null; + } + list(, $folderId) = explode('/', $relativePath); $trashItem = $this->trashManager->getTrashItemByFileId($fileId); $originalPath = $folderId . '/' . ($trashItem ? $trashItem['original_location'] : '/'); if ($this->userHasAccessToFolder($user, (int)$folderId) && $this->userHasAccessToPath($user, $originalPath)) { |