diff --git a/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/KnownPathResourceManager.java b/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/KnownPathResourceManager.java index d2d68e83c387a..bac53c8446fea 100644 --- a/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/KnownPathResourceManager.java +++ b/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/KnownPathResourceManager.java @@ -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 @@ -134,9 +138,7 @@ public List 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);