Improve efficiency of UrlPathHelper#getSanitizedPath

See gh-27623
This commit is contained in:
happyWilliam0
2021-10-29 14:14:05 +08:00
committed by Rossen Stoyanchev
parent c5de5c9939
commit b5743966d6
2 changed files with 17 additions and 10 deletions

View File

@@ -246,6 +246,12 @@ class UrlPathHelperTests {
request.setRequestURI("/SPR-12372/foo/bar//");
assertThat(helper.getLookupPathForRequest(request)).isEqualTo("/foo/bar//");
// "enhance" case
request.setServletPath("/foo/bar//");
request.setRequestURI("/SPR-12372////////////////////////foo//////////////////bar////////////////////");
assertThat(helper.getLookupPathForRequest(request)).isEqualTo("/foo/bar//");
}
@Test