UrlHandlerFilter should not strip slash for "/" request paths

This commit ensures that the `UrlHandlerFilter` does not handle "/"
paths in general, as they should not be altered and are meaningful for
web applications.

Closes gh-33444
This commit is contained in:
Brian Clozel
2024-09-02 15:29:42 +02:00
parent 69d5587f53
commit be5d5fa52d
2 changed files with 18 additions and 1 deletions

View File

@@ -279,7 +279,7 @@ public final class UrlHandlerFilter extends OncePerRequestFilter {
@Override
public boolean canHandle(HttpServletRequest request, RequestPath path) {
List<PathContainer.Element> elements = path.elements();
return (!elements.isEmpty() && elements.get(elements.size() - 1).value().equals("/"));
return (elements.size() > 1 && elements.get(elements.size() - 1).value().equals("/"));
}
@Override