Skip to content

Commit dc3f953

Browse files
committed
Correction for commit #b219c6c
Issue: SPR-17630
1 parent 4058361 commit dc3f953

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

spring-web/src/main/java/org/springframework/web/util/UriComponentsBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ public URI build(Map<String, ?> uriVariables) {
458458
*/
459459
public String toUriString() {
460460
return this.uriVariables.isEmpty() ?
461-
encode().build().toUriString() :
461+
build().encode().toUriString() :
462462
buildInternal(EncodingHint.ENCODE_TEMPLATE).toUriString();
463463
}
464464

spring-web/src/test/java/org/springframework/web/util/UriComponentsBuilderTests.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,4 +934,9 @@ public void uriComponentsWithMergedQueryParams() {
934934
assertEquals("http://localhost:8081/{path}?sort={sort}&sort=another_value", uri);
935935
}
936936

937+
@Test // SPR-17630
938+
public void toUriStringWithCurlyBraces() {
939+
assertEquals("/path?q=%7Basa%7Dasa",
940+
UriComponentsBuilder.fromUriString("/path?q={asa}asa").toUriString());
941+
}
937942
}

0 commit comments

Comments
 (0)