Skip to content

Commit

Permalink
CleanFolder now report unauthorised even of folder does not exist.
Browse files Browse the repository at this point in the history
  • Loading branch information
vertigo17 committed Nov 4, 2023
1 parent c3ca1b8 commit 619d8ad
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -295,14 +295,15 @@ private JSONObject clean_folder(String filenamecomplete, String authorisedFolder
filename = "";
}

if (!pathDir.exists()) {
actionResult.put("message", "Path '" + pathDir.getAbsolutePath() + "' does not exist !! We consider it as empty/cleaned already...");
actionResult.put("status", "OK");
actionResult.put("code", 200);
} else if (!check_authorisation(pathDir, authorisedFolderScope)) {
actionResult.put("message", "Path '" + pathDir.getAbsolutePath() + "' is not authorised !! The path '" + pathDir.toPath().toRealPath().toString() + File.separator + "' is not inside '" + authorisedFolderScope + "'.");
if (!check_authorisation(pathDir, authorisedFolderScope)) {
actionResult.put("message", "Path '" + pathDir.getAbsolutePath() + "' is not authorised !! It is not inside '" + authorisedFolderScope + "'.");
actionResult.put("status", "Failed");
actionResult.put("code", 403);
} else if (!pathDir.exists()) {
pathDir.mkdirs();
actionResult.put("message", "Path '" + pathDir.getAbsolutePath() + "' does not exist !! Folder created and cleaned...");
actionResult.put("status", "OK");
actionResult.put("code", 200);
} else {
// Get all files.
File[] rawfiles;
Expand Down

0 comments on commit 619d8ad

Please sign in to comment.