Skip to content

Commit

Permalink
Merge pull request 'fix: add file existence check before save. Fix Bu…
Browse files Browse the repository at this point in the history
…g 69948' (#2) from fix/java-check-file-exist into release/v1.10.0

Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/document-server-integration/pulls/2
  • Loading branch information
LinneyS committed Sep 18, 2024
2 parents 4c8fb6b + 14df5fc commit 73b727f
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,12 @@ public static void processSave(final JSONObject body,
ver.mkdirs();
}

// get the path to the previous file version and rename the last file version with it
lastVersion.renameTo(new File(versionDir + File.separator + "prev." + curExt));
if (lastVersion.exists()) {
// get the path to the previous file version and rename the last file version with it
lastVersion.renameTo(new File(versionDir + File.separator + "prev." + curExt));
} else {
throw new Exception("The file not exist: " + lastVersion.getAbsolutePath());
}

saveFile(byteArrayFile, toSave); // save document file

Expand Down

0 comments on commit 73b727f

Please sign in to comment.