Updated Branches:
  refs/heads/master eb5e94a27 -> ec1bc9ca3

WICKET-4588 non-relative redirects do not work properly


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/ec1bc9ca
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/ec1bc9ca
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/ec1bc9ca

Branch: refs/heads/master
Commit: ec1bc9ca3657d5e4805b31c0b5e4396e8bc897e4
Parents: eb5e94a
Author: Martin Tzvetanov Grigorov <mgrigo...@apache.org>
Authored: Fri Jun 15 11:55:15 2012 +0300
Committer: Martin Tzvetanov Grigorov <mgrigo...@apache.org>
Committed: Fri Jun 15 11:55:15 2012 +0300

----------------------------------------------------------------------
 .../wicket/ajax/res/js/wicket-ajax-jquery.js       |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/ec1bc9ca/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js 
b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
index 772049c..5c2b7fa 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
+++ 
b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
@@ -609,8 +609,11 @@
                                        // A file download popup will appear 
but the page in the browser won't change.
                                        this.done();
 
+                                       var rhttp  = /^http:\/\//,  // checks 
whether the string starts with http://
+                                           rhttps = /^https:\/\//; // checks 
whether the string starts with https://
+
                                        // support/check for non-relative 
redirectUrl like as provided and needed in a portlet context
-                                       if (redirectUrl.charAt(0) === ('/') || 
redirectUrl.match("^http://";) === "http://"; || redirectUrl.match("^https://";) 
=== "https://";) {
+                                       if (redirectUrl.charAt(0)==('/') || 
rhttp.test(redirectUrl) || rhttps.test(redirectUrl)) {
                                                window.location = redirectUrl;
                                        }
                                        else {

Reply via email to