Skip to content

Commit

Permalink
Undertow file servlet listing
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Apr 15, 2023
1 parent 6613666 commit fb8acac
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ private class DirectoryResource implements Resource {
private final String path;

private DirectoryResource(String path) {
this.path = path.replaceAll("\\\\", "/");
this.path = evaluatePath(path);
}

private String evaluatePath(String path) {
return IS_WINDOWS ? path.replaceAll("\\\\", "/") : path;
}

@Override
Expand Down Expand Up @@ -134,9 +138,7 @@ public List<Resource> list() {
continue;
}
if (i.startsWith(slashPath)) {
if (IS_WINDOWS) {
i = i.replaceAll("\\\\", "/"); // correct Windows paths
}
i = evaluatePath(i);
if (!i.substring(slashPath.length()).contains("/")) {
try {
Resource resource = underlying.getResource(i);
Expand Down

0 comments on commit fb8acac

Please sign in to comment.