Trim the uri in UriParser::GetComponents, just like we do in Uri::Parse
authorRolf Bjarne Kvinge <RKvinge@novell.com>
Tue, 31 Aug 2010 10:54:08 +0000 (12:54 +0200)
committerRolf Bjarne Kvinge <RKvinge@novell.com>
Tue, 31 Aug 2010 15:18:48 +0000 (17:18 +0200)
mcs/class/System/System/UriParser.cs
mcs/class/System/Test/System/UriTest.cs

index 300dafba14e4417da6712c5314d4d3286fd59ab3..7a948b464f107e27448bd44c9f7dd9db9fa01699 100644 (file)
@@ -70,7 +70,7 @@ namespace System {
                        if ((format < UriFormat.UriEscaped) || (format > UriFormat.SafeUnescaped))
                                throw new ArgumentOutOfRangeException ("format");
 
-                       Match m = uri_regex.Match (uri.OriginalString);
+                       Match m = uri_regex.Match (uri.OriginalString.Trim ());
 
                        string scheme = scheme_name;
                        int dp = default_port;
index 2e70ffed4fbfcd50f9d8ea7951575a02223134c2..2c9d43cd32a7f3dd2fef231efc678a7c0897aadc 100644 (file)
@@ -69,6 +69,7 @@ namespace MonoTests.System
 
                        uri = new Uri("  \r  \n http://test.com\r\n \r\r  ");
                        Assert.AreEqual ("http://test.com/", uri.ToString(), "#k0");
+                       Assert.AreEqual ("http", uri.GetComponents (UriComponents.Scheme, UriFormat.UriEscaped), "#k0-gc");
 
                        uri = new Uri ("http://contoso.com?subject=uri");
                        Assert.AreEqual ("/", uri.AbsolutePath, "#k1");