Skip to content
Merged
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
8 changes: 8 additions & 0 deletions lib/Service/DocumentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,14 @@ public function getFileById(int $fileId, ?string $userId = null): File {
throw new NotFoundException();
}

// We currently don't know the path nor care about which file mount it is when getting by id
// therefore we can take a shortcut on the cached node if we have edit permissions on that
$file = $userFolder->getFirstNodeById($fileId);
if ($file instanceof File && $file->getPermissions() & Constants::PERMISSION_UPDATE) {
return $file;
}

// Ideally we'd optimize this part in the future by storing the path and getting the acutal target directly
$files = $userFolder->getById($fileId);
if (count($files) === 0) {
throw new NotFoundException();
Expand Down