File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -665,7 +665,10 @@ public function putFile(
665665 $ this ->wrappedFilesystemOperation ($ wopi , fn () => $ file ->putContent ($ content ));
666666 } catch (LockedException $ e ) {
667667 $ this ->logger ->error ($ e ->getMessage (), ['exception ' => $ e ]);
668- return new JSONResponse (['message ' => 'File locked ' ], Http::STATUS_INTERNAL_SERVER_ERROR );
668+ // The file is locked by another operation and we wrote nothing.
669+ // Report it as such, so the client can retry rather than treat
670+ // this as a server fault or as a change behind its back.
671+ return new JSONResponse (['message ' => 'File locked ' ], Http::STATUS_LOCKED );
669672 }
670673
671674 if ($ wopi ->hasTemplateId ()) {
@@ -808,7 +811,8 @@ public function postFile(
808811 try {
809812 $ this ->wrappedFilesystemOperation ($ wopi , fn () => $ file ->putContent ($ content ));
810813 } catch (LockedException ) {
811- return new JSONResponse (['message ' => 'File locked ' ], Http::STATUS_INTERNAL_SERVER_ERROR );
814+ // As in putFile(): nothing was written, so this is not a server fault.
815+ return new JSONResponse (['message ' => 'File locked ' ], Http::STATUS_LOCKED );
812816 }
813817
814818 // epub is exception (can be uploaded but not opened so don't try to get access token)
You can’t perform that action at this time.
0 commit comments