From 17b12d3dccb46f6950f73a50d038f18f13bceb8d Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 6 Jun 2024 11:26:57 +0200 Subject: [PATCH] fix(locks): only lock when editing Read only shares should not lock a document. Prevent file sync conflicts when nobody is editing. See #5862. Signed-off-by: Max --- lib/Service/ApiService.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Service/ApiService.php b/lib/Service/ApiService.php index 760ee908628..be2aee01751 100644 --- a/lib/Service/ApiService.php +++ b/lib/Service/ApiService.php @@ -164,9 +164,11 @@ public function create(?int $fileId = null, ?string $filePath = null, ?string $b $lockInfo = null; } - $isLocked = $this->documentService->lock($file->getId()); - if (!$isLocked) { - $readOnly = true; + if (!$readOnly) { + $isLocked = $this->documentService->lock($file->getId()); + if (!$isLocked) { + $readOnly = true; + } } return new DataResponse([