Skip to content

Commit

Permalink
COMMANDBOX-1625
Browse files Browse the repository at this point in the history
  • Loading branch information
bdw429s committed Jun 28, 2024
1 parent 5c05cdd commit 7f511aa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/runwar/undertow/WelcomeFileHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import io.undertow.server.handlers.resource.Resource;
import io.undertow.server.handlers.resource.ResourceManager;
import io.undertow.util.CanonicalPathUtils;
import io.undertow.util.RedirectBuilder;
import io.undertow.util.StatusCodes;

public class WelcomeFileHandler implements HttpHandler {

Expand All @@ -24,7 +26,7 @@ public class WelcomeFileHandler implements HttpHandler {
@Override
public void handleRequest(final HttpServerExchange exchange) throws Exception {
Resource resource = resourceManager.getResource(canonicalize(exchange.getRelativePath()));
if (resource != null && resource.isDirectory()) {
if (resource != null && resource.isDirectory() && exchange.getRelativePath().endsWith("/")) {
Resource indexResource = getIndexFiles(exchange, resourceManager, resource.getPath(), welcomeFiles);
if (indexResource != null) {
String newPath = indexResource.getPath();
Expand Down

0 comments on commit 7f511aa

Please sign in to comment.