Skip to content

Commit 7582adc

Browse files
committed
Fix trailing slash in nested path
This commit adds a trailing slash to the nested path if the request path also ends with a slash. For instance, given the request "/foo/bar/", and nested path pattern "/foo/**", we expect the nested path to be “/bar/”, not “/bar".
1 parent babd551 commit 7582adc

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RequestPredicates.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,9 @@ public ServerRequest nestRequest(ServerRequest request) {
386386
if (!subPath.startsWith("/")) {
387387
subPath = "/" + subPath;
388388
}
389+
if (requestPath.endsWith("/") && !subPath.endsWith("/")) {
390+
subPath += "/";
391+
}
389392
return new SubPathServerRequestWrapper(request, subPath);
390393
}
391394

0 commit comments

Comments
 (0)