Lenient URI template encoding

URI template encoding ignores mismatched curly braces, treating them as
literal parts instead.

Issue: SPR-17630
This commit is contained in:
Rossen Stoyanchev
2019-01-02 16:36:08 -05:00
parent 0742160821
commit 124e8179b2
3 changed files with 45 additions and 24 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -131,6 +131,12 @@ public class UriComponentsTests {
assertEquals("/myurl/test/show", uriComponents.getPath());
}
@Test // SPR-17630
public void uirTemplateExpandWithMismatchedCurlyBraces() {
assertEquals("/myurl/?q=%7B%7B%7B%7B",
UriComponentsBuilder.fromUriString("/myurl/?q={{{{").encode().build().toUriString());
}
@Test // SPR-12123
public void port() {
UriComponents uri1 = fromUriString("http://example.com:8080/bar").build();