diff options
author | Max <max@nextcloud.com> | 2022-03-07 11:22:14 +0300 |
---|---|---|
committer | nextcloud-command <nextcloud-command@users.noreply.github.com> | 2022-03-09 08:23:18 +0300 |
commit | fd6395128cfb4ddc2aa28b1587903202eecdc16a (patch) | |
tree | 20f80cd5da2ab19ee76f6bf503634b054c27e580 /lib | |
parent | 44737f20095f30ef2440f8667a21e21decf9d648 (diff) |
performance: fetch content during session creation
Signed-off-by: Max <max@nextcloud.com>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Service/ApiService.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Service/ApiService.php b/lib/Service/ApiService.php index 7207e7250..1ef829466 100644 --- a/lib/Service/ApiService.php +++ b/lib/Service/ApiService.php @@ -106,10 +106,18 @@ class ApiService { } $session = $this->sessionService->initSession($document->getId(), $guestName); + try { + $baseFile = $this->documentService->getBaseFile($document->getId()); + $content = $baseFile->getContent(); + } catch (NotFoundException $e) { + $this->logger->logException($e, ['level' => ILogger::INFO]); + $content = null; + } return new DataResponse([ 'document' => $document, 'session' => $session, - 'readOnly' => $readOnly + 'readOnly' => $readOnly, + 'content' => $content ]); } |