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: 7 additions & 1 deletion lib/Service/DocumentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,13 @@ public function getFileById($fileId, $userId = null): Node {
throw new NotFoundException();
}

return $files[0];
// Workaround to always open files with edit permissions if multiple occurences of
// the same file id are in the user home, ideally we should also track the path of the file when opening
usort($files, function (Node $a, Node $b) {
return ($a->getPermissions() & Constants::PERMISSION_UPDATE) < ($b->getPermissions() & Constants::PERMISSION_UPDATE);
});

return array_shift($files);
}

/**
Expand Down