SPR-7471 - Regression in redirect URL encoding
This commit is contained in:
@@ -214,7 +214,7 @@ public class RedirectView extends AbstractUrlBasedView {
|
|||||||
if (this.contextRelative && getUrl().startsWith("/")) {
|
if (this.contextRelative && getUrl().startsWith("/")) {
|
||||||
// Do not apply context path to relative URLs.
|
// Do not apply context path to relative URLs.
|
||||||
targetUrl.append(UriUtils.encodePath(request.getContextPath(), encoding));
|
targetUrl.append(UriUtils.encodePath(request.getContextPath(), encoding));
|
||||||
targetUrl.append(UriUtils.encodePath(getUrl(), encoding));
|
targetUrl.append(UriUtils.encodeUri(getUrl(), encoding));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
targetUrl.append(UriUtils.encodeUri(getUrl(), encoding));
|
targetUrl.append(UriUtils.encodeUri(getUrl(), encoding));
|
||||||
|
|||||||
@@ -136,6 +136,12 @@ public class RedirectViewTests {
|
|||||||
doTest(model, url, false, expectedUrlForEncoding);
|
doTest(model, url, false, expectedUrlForEncoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void contextRelativeQueryParam() throws Exception {
|
||||||
|
String url = "/test.html?id=1";
|
||||||
|
doTest(new HashMap<String, Object>(), url, true, url);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void twoParams() throws Exception {
|
public void twoParams() throws Exception {
|
||||||
String url = "http://url.somewhere.com";
|
String url = "http://url.somewhere.com";
|
||||||
|
|||||||
Reference in New Issue
Block a user