Fixes Uri.UserInfo with spaces.
authorMarcos Henrich <marcos.henrich@xamarin.com>
Fri, 4 Sep 2015 04:36:27 +0000 (05:36 +0100)
committerMarcos Henrich <marcos.henrich@xamarin.com>
Fri, 4 Sep 2015 04:36:27 +0000 (05:36 +0100)
Fixes #31172.

mcs/class/System/System/UriParseComponents.cs

index 2e1e3c5d485118e4e1867f270de0e156a343fdb6..593ef053eac352c8a2a98bc01173657d7a8d05b7 100644 (file)
@@ -326,6 +326,14 @@ namespace System {
                                bool isEscapedChar = false;
                                var oldIndex = index;
 
+                               // Spaces should be percentage encoded #31172
+                               if (ch == ' ') {
+                                       if (sb == null)
+                                               sb = new StringBuilder ();
+                                       sb.Append ("%20");
+                                       continue;
+                               }
+
                                if (ch == '%'){
                                        if (!Uri.IsHexEncoding (part, index))
                                                return false;