File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -701,7 +701,10 @@ public function putFile(
701701 $ this ->wrappedFilesystemOperation ($ wopi , fn () => $ file ->putContent ($ content ));
702702 } catch (LockedException $ e ) {
703703 $ this ->logger ->error ($ e ->getMessage (), ['exception ' => $ e ]);
704- return new JSONResponse (['message ' => 'File locked ' ], Http::STATUS_INTERNAL_SERVER_ERROR );
704+ // The file is locked by another operation and we wrote nothing.
705+ // Report it as such, so the client can retry rather than treat
706+ // this as a server fault or as a change behind its back.
707+ return new JSONResponse (['message ' => 'File locked ' ], Http::STATUS_LOCKED );
705708 }
706709
707710 if ($ isPutRelative ) {
@@ -849,7 +852,8 @@ public function postFile(
849852 try {
850853 $ this ->wrappedFilesystemOperation ($ wopi , fn () => $ file ->putContent ($ content ));
851854 } catch (LockedException ) {
852- return new JSONResponse (['message ' => 'File locked ' ], Http::STATUS_INTERNAL_SERVER_ERROR );
855+ // As in putFile(): nothing was written, so this is not a server fault.
856+ return new JSONResponse (['message ' => 'File locked ' ], Http::STATUS_LOCKED );
853857 }
854858
855859 // 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