File tree Expand file tree Collapse file tree
main/java/com/gooddata/collections
test/java/com/gooddata/collections Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77
88import org .springframework .web .util .UriComponents ;
99import org .springframework .web .util .UriComponentsBuilder ;
10+ import org .springframework .web .util .UriUtils ;
1011
12+ import java .io .UnsupportedEncodingException ;
1113import java .net .URI ;
1214import java .util .List ;
1315import java .util .Map .Entry ;
@@ -27,7 +29,11 @@ class UriPage implements Page {
2729 * @param pageUri page URI
2830 */
2931 public UriPage (final String pageUri ) {
30- this .pageUri = UriComponentsBuilder .fromUriString (notNull (pageUri , "pageUri" )).build ();
32+ try {
33+ this .pageUri = UriComponentsBuilder .fromUriString (UriUtils .decode (notNull (pageUri , "pageUri" ), "UTF-8" )).build ();
34+ } catch (final UnsupportedEncodingException e ) {
35+ throw new IllegalStateException (e );
36+ }
3137 }
3238
3339 /**
Original file line number Diff line number Diff line change @@ -63,4 +63,10 @@ public void testIdempotency() throws Exception {
6363 assertThat (components .getQueryParams (), hasEntry ("offset" , singletonList ("god" )));
6464 assertThat (components .getQueryParams (), hasEntry ("limit" , singletonList ("10" )));
6565 }
66+
67+ @ Test
68+ public void testEncoding () throws Exception {
69+ final UriPage uri = new UriPage ("uri?test=foo%20bar" );
70+ assertThat (uri .getPageUri (null ).toString (), is ("uri?test=foo%20bar" ));
71+ }
6672}
You can’t perform that action at this time.
0 commit comments