From 7582adc0bc4d9456465338f92198fbcbdc84151a Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Tue, 21 Feb 2017 13:43:59 +0100 Subject: [PATCH] Fix trailing slash in nested path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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". --- .../web/reactive/function/server/RequestPredicates.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RequestPredicates.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RequestPredicates.java index 668a3826619..06a9bf71253 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RequestPredicates.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RequestPredicates.java @@ -386,6 +386,9 @@ public abstract class RequestPredicates { if (!subPath.startsWith("/")) { subPath = "/" + subPath; } + if (requestPath.endsWith("/") && !subPath.endsWith("/")) { + subPath += "/"; + } return new SubPathServerRequestWrapper(request, subPath); }