You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2013/04/08 11:53:27 UTC

git commit: WICKET-5114 Url#toString(StringMode.FULL) throws exception if a segment contains two dots

Updated Branches:
  refs/heads/master e0d2b7c38 -> 518c933bb


WICKET-5114 Url#toString(StringMode.FULL) throws exception if a segment contains two dots


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

Branch: refs/heads/master
Commit: 518c933bb31c35b736253936ba080ac21e6cb19f
Parents: e0d2b7c
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Mon Apr 8 12:53:02 2013 +0300
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon Apr 8 12:53:02 2013 +0300

----------------------------------------------------------------------
 .../main/java/org/apache/wicket/request/Url.java   |    2 +-
 .../java/org/apache/wicket/request/UrlTest.java    |   16 +++++++++++++++
 2 files changed, 17 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/518c933b/wicket-request/src/main/java/org/apache/wicket/request/Url.java
----------------------------------------------------------------------
diff --git a/wicket-request/src/main/java/org/apache/wicket/request/Url.java b/wicket-request/src/main/java/org/apache/wicket/request/Url.java
index 12ca5f0..9ca2c0d 100755
--- a/wicket-request/src/main/java/org/apache/wicket/request/Url.java
+++ b/wicket-request/src/main/java/org/apache/wicket/request/Url.java
@@ -674,7 +674,7 @@ public class Url implements Serializable
 				result.append(port);
 			}
 
-			if (path.contains(".."))
+			if (segments.contains(".."))
 			{
 				throw new IllegalStateException("Cannot render this url in " +
 					StringMode.FULL.name() + " mode because it has a `..` segment: " + toString());

http://git-wip-us.apache.org/repos/asf/wicket/blob/518c933b/wicket-request/src/test/java/org/apache/wicket/request/UrlTest.java
----------------------------------------------------------------------
diff --git a/wicket-request/src/test/java/org/apache/wicket/request/UrlTest.java b/wicket-request/src/test/java/org/apache/wicket/request/UrlTest.java
index 91a4914..eaebe14 100644
--- a/wicket-request/src/test/java/org/apache/wicket/request/UrlTest.java
+++ b/wicket-request/src/test/java/org/apache/wicket/request/UrlTest.java
@@ -911,4 +911,20 @@ public class UrlTest extends Assert
 
 		url.removeLeadingSegments(3);
 	}
+
+    @Test
+    public void wicket_5114_allowtoStringFullWhenContainingTwoDots()
+    {
+        Url url = Url.parse("/mountPoint/whatever.../");
+        url.setHost("wicketHost");
+        assertEquals("//wicketHost/mountPoint/whatever.../", url.toString(StringMode.FULL));
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void wicket_5114_throwExceptionWhenToStringFullContainsRelativePathSegment()
+    {
+        Url url = Url.parse("/mountPoint/../whatever/");
+        url.setHost("wicketHost");
+        url.toString(StringMode.FULL);
+    }
 }