File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -663,7 +663,10 @@ public function putFile(
663663 $ this ->wrappedFilesystemOperation ($ wopi , fn () => $ file ->putContent ($ content ));
664664 } catch (LockedException $ e ) {
665665 $ this ->logger ->error ($ e ->getMessage (), ['exception ' => $ e ]);
666- return new JSONResponse (['message ' => 'File locked ' ], Http::STATUS_INTERNAL_SERVER_ERROR );
666+ // The file is locked by another operation and we wrote nothing.
667+ // Report it as such, so the client can retry rather than treat
668+ // this as a server fault or as a change behind its back.
669+ return new JSONResponse (['message ' => 'File locked ' ], Http::STATUS_LOCKED );
667670 }
668671
669672 if ($ wopi ->hasTemplateId ()) {
@@ -805,7 +808,8 @@ public function postFile(
805808 try {
806809 $ this ->wrappedFilesystemOperation ($ wopi , fn () => $ file ->putContent ($ content ));
807810 } catch (LockedException ) {
808- return new JSONResponse (['message ' => 'File locked ' ], Http::STATUS_INTERNAL_SERVER_ERROR );
811+ // As in putFile(): nothing was written, so this is not a server fault.
812+ return new JSONResponse (['message ' => 'File locked ' ], Http::STATUS_LOCKED );
809813 }
810814
811815 // 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