Skip to content

Commit

Permalink
fix: file not found when not readable or parent not readable (#3985)
Browse files Browse the repository at this point in the history
  • Loading branch information
ymarcon authored Jan 12, 2025
1 parent 93ac95b commit 9ff3824
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions opal-core-ws/src/main/java/org/obiba/opal/web/FilesResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,13 @@ public Response getFileSystemRootDetails() throws IOException {
@NoAuthorization
public Response getFileDetails(@PathParam("path") String path) throws IOException {
FileObject file = resolveFileInFileSystem(path);
return file.exists()
? file.getType() == FileType.FILE ? getFileDetails(file) : getFolderDetails(file)
: getPathNotExistResponse("/" + path);
if (!file.getParent().isReadable() || !file.exists()) {
return getPathNotExistResponse("/" + path);
}
if (file.getType() == FileType.FILE) {
return file.isReadable() ? getFileDetails(file) : getPathNotExistResponse("/" + path);
}
return getFolderDetails(file);
}

@GET
Expand Down

0 comments on commit 9ff3824

Please sign in to comment.