URL creation in wicket-ajax.js -> Wicket.Ajax.Call.doGet produces broken URLs 
for Gecko
---------------------------------------------------------------------------------------

                 Key: WICKET-1426
                 URL: https://issues.apache.org/jira/browse/WICKET-1426
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.3.2
         Environment: Firefox 2
            Reporter: Martin Grigorov


With r628015 (Wicket 1.3.2) creation of full URL for Gecko browsers creates 
broken URLs when there is a slash ('/') in the http parameter values.

For example when a page with this URL is loaded: 
http://localhost/app?key=value/ 
 wicketAjaxGet will issue a query with this content:
http://localhost/app?key=value/../?wicket:interface=:....

By RFC2396 the query part of URL could be:

 query         = *uric
 uric          = reserved | unreserved | escaped
 reserved      = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
                      "$" | ","
 unreserved    = alphanum | mark

So '/' is allowed.

Here is a quick patch:

--- wicket-ajax.js      (revision 637425)
+++ wicket-ajax.js      (working copy)
@@ -823,6 +823,10 @@
                        if (t != null) {
                                if (Wicket.Browser.isGecko()) {
                                        var href = document.location.href;
+                                       var lastIndexOfQuestionMark = 
href.lastIndexOf('?');
+                                       if (lastIndexOfQuestionMark > -1) {
+                                               href = href.substring(0, 
lastIndexOfQuestionMark);
+                                       }
                                        var lastIndexOf = href.lastIndexOf('/');
                                        if (lastIndexOf > 0)
                                        {


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to