Permalink
Browse files

Prevent url encoding for controller and action

Currently, the controller name and action name are url-encoded when creating an HTML link.
But I want to be able to configure my controller to have a featureUri with a slash in it - e.g. "admin/myController". This should be possible using the UrlMappings framework, but currently fails because the slash is encoded to "%2F" by the LinkGenerator. So the URI becomes "admin%2FmyController".
This patch prevents URL-encoding the controller name and action, when creating a URL.
  • Loading branch information...
1 parent 04b45ca commit ec28a8c082b306f6e8b011a39821bec6edafd018 @mckenfra committed Oct 27, 2012
@@ -249,9 +249,9 @@ protected void appendUrlToken(FastStringWriter actualUriBuf, Object token, Strin
/*
* Appends a URL token to the buffer
*
- * @param urlEncode If true, url encodes the token before append
+ * @param needsUrlEncode If true, url encodes the token before append
*/
- protected void appendUrlToken(FastStringWriter actualUriBuf, Object token, String charset, boolean urlEncode) {
- actualUriBuf.append(SLASH).append(urlEncode(token, charset));
+ protected void appendUrlToken(FastStringWriter actualUriBuf, Object token, String charset, boolean needsUrlEncode) {
+ actualUriBuf.append(SLASH).append(needsUrlEncode ? urlEncode(token, charset) : token);
}
}

0 comments on commit ec28a8c

Please sign in to comment.