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: 6 additions & 2 deletions lib/Controller/WopiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,10 @@ public function putFile(string $fileId, string $access_token): JSONResponse {
$this->wrappedFilesystemOperation($wopi, fn () => $file->putContent($content));
} catch (LockedException $e) {
$this->logger->error($e->getMessage(), ['exception' => $e]);
return new JSONResponse(['message' => 'File locked'], Http::STATUS_INTERNAL_SERVER_ERROR);
// The file is locked by another operation and we wrote nothing.
// Report it as such, so the client can retry rather than treat
// this as a server fault or as a change behind its back.
return new JSONResponse(['message' => 'File locked'], Http::STATUS_LOCKED);
}

if ($isPutRelative) {
Expand Down Expand Up @@ -819,7 +822,8 @@ public function postFile(string $fileId, string $access_token): JSONResponse {
try {
$this->wrappedFilesystemOperation($wopi, fn () => $file->putContent($content));
} catch (LockedException) {
return new JSONResponse(['message' => 'File locked'], Http::STATUS_INTERNAL_SERVER_ERROR);
// As in putFile(): nothing was written, so this is not a server fault.
return new JSONResponse(['message' => 'File locked'], Http::STATUS_LOCKED);
}

// epub is exception (can be uploaded but not opened so don't try to get access token)
Expand Down
Loading