You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by pa...@apache.org on 2017/05/30 15:55:10 UTC

wicket git commit: WICKET-6376: allow non-http(s) uris in ajax redirects

Repository: wicket
Updated Branches:
  refs/heads/master 1439e553b -> 12305d9f5


WICKET-6376: allow non-http(s) uris in ajax redirects


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

Branch: refs/heads/master
Commit: 12305d9f5f7d644282541e1858b2fec41cb57579
Parents: 1439e55
Author: Emond Papegaaij <pa...@apache.org>
Authored: Tue May 30 17:54:56 2017 +0200
Committer: Emond Papegaaij <pa...@apache.org>
Committed: Tue May 30 17:54:56 2017 +0200

----------------------------------------------------------------------
 .../java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js    | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/12305d9f/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 0f25238..f0289fc 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
@@ -780,11 +780,10 @@
 					// A file download popup will appear but the page in the browser won't change.
 					this.success(context);
 
-					var rhttp  = /^http:\/\//,  // checks whether the string starts with http://
-					    rhttps = /^https:\/\//; // checks whether the string starts with https://
+					var withScheme  = /^[a-z][a-z0-9+.-]*:\/\//;  // checks whether the string starts with a scheme
 
 					// support/check for non-relative redirectUrl like as provided and needed in a portlet context
-					if (redirectUrl.charAt(0) === '/' || rhttp.test(redirectUrl) || rhttps.test(redirectUrl)) {
+					if (redirectUrl.charAt(0) === '/' || withScheme.test(redirectUrl)) {
 						context.isRedirecting = true;
 						Wicket.Ajax.redirect(redirectUrl);
 					}