Skip to content

Commit bc3e533

Browse files
committed
fix(sync): do not check for conflicts during sync
The document may be in the middle of getting saved. When the file has been updated but the metadata in the documents table has not it may seem like the file was overwritten even though text is saving the file. This does not indicate an actual conflict. Avoid triggering the conflict screen in that race condition. Signed-off-by: Max <max@nextcloud.com>
1 parent 3a1c7e5 commit bc3e533

1 file changed

Lines changed: 1 addition & 9 deletions

File tree

lib/Service/ApiService.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ public function sync(Session $session, Document $document, int $version = 0, ?st
175175
// ensure file is still present and accessible
176176
$file = $this->fileService->getFileForSession($session, $shareToken);
177177
$result['readOnly'] = $this->fileService->isReadOnly($file, $shareToken);
178-
$this->documentService->assertNoOutsideConflict($document, $file);
179178
} catch (NotPermittedException|NotFoundException|InvalidPathException $e) {
180179
$this->logger->info($e->getMessage(), ['exception' => $e]);
181180
return new DataResponse([
@@ -186,16 +185,9 @@ public function sync(Session $session, Document $document, int $version = 0, ?st
186185
return new DataResponse([
187186
'message' => 'Document no longer exists'
188187
], Http::STATUS_NOT_FOUND);
189-
} catch (DocumentSaveConflictException) {
190-
try {
191-
/** @psalm-suppress PossiblyUndefinedVariable */
192-
$result['outsideChange'] = $file->getContent();
193-
} catch (LockedException) {
194-
// Ignore locked exception since it might happen due to an autosave action happening at the same time
195-
}
196188
}
197189

198-
return new DataResponse($result, isset($result['outsideChange']) ? Http::STATUS_CONFLICT : Http::STATUS_OK);
190+
return new DataResponse($result, Http::STATUS_OK);
199191
}
200192

201193
public function save(Session $session, Document $document, int $version, string $autosaveContent, string $documentState, bool $force = false, bool $manualSave = false, ?string $shareToken = null): DataResponse {

0 commit comments

Comments
 (0)