Improve URI/query strings sanitization

This commit is contained in:
Сергей Цыпанов
2020-11-02 12:49:00 +02:00
committed by Juergen Hoeller
parent b077e4cd85
commit 0015fd6734
6 changed files with 47 additions and 30 deletions

View File

@@ -1200,4 +1200,9 @@ class UriComponentsBuilderTests {
assertThat(UriComponentsBuilder.fromUriString("/path?q={asa}asa").toUriString()).isEqualTo("/path?q=%7Basa%7Dasa");
}
@Test
void verifyDoubleSlashReplacedWithSingleOne() {
String path = UriComponentsBuilder.fromPath("/home/").path("/path").build().getPath();
assertThat(path).isEqualTo("/home/path");
}
}

View File

@@ -104,6 +104,9 @@ public class UrlPathHelperTests {
request.setRequestURI("/foo+bar");
assertThat(helper.getRequestUri(request)).isEqualTo("/foo+bar");
request.setRequestURI("/home/" + "/path");
assertThat(helper.getRequestUri(request)).isEqualTo("/home/path");
}
@Test