Skip to content
Prev Previous commit
Next Next commit
Fix path value
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Aug 16, 2022
commit f90aaab8e8f725dbb56642829cacae146ec77fd2
9 changes: 6 additions & 3 deletions lib/ViewInfoCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,18 @@ protected function findInfoById($user, $fileId, $filePath) {

$notFound = false;
try {
$entries = $this->rootFolder->getUserFolder($user)->getById($fileId);
$userFolder = $this->rootFolder->getUserFolder($user);
$entries = $userFolder->getById($fileId);
if (empty($entries)) {
throw new NotFoundException('No entries returned');
}
/** @var Node $entry */
$entry = array_shift($entries);

$cache['path'] = $entry->getPath();
$cache['path'] = substr($entry->getPath(), strlen($userFolder->getPath()));
$cache['is_dir'] = $entry instanceof Folder;
$cache['exists'] = true;
$cache['node'] = $entry;
} catch (NotFoundException $e) {
// The file was not found in the normal view,
// maybe it is in the trashbin?
Expand All @@ -107,10 +109,11 @@ protected function findInfoById($user, $fileId, $filePath) {
$entry = array_shift($entries);

$cache = [
'path' => substr($entry->getPath(), strlen('/files')),
'path' => substr($entry->getPath(), strlen($userTrashBin->getPath())),
'exists' => true,
'is_dir' => $entry instanceof Folder,
'view' => 'trashbin',
'node' => $entry,
];
} catch (NotFoundException $e) {
$notFound = true;
Expand Down