2004-01-05 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Mon, 5 Jan 2004 14:50:11 +0000 (14:50 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Mon, 5 Jan 2004 14:50:11 +0000 (14:50 -0000)
* Uri.cs : fixed IsBadFileSystemCharacter() to reject more characters
  based on MS.NET experiment.

svn path=/trunk/mcs/; revision=21714

mcs/class/System/System/ChangeLog
mcs/class/System/System/Uri.cs

index ebc13ddc7df8ead3b7830c361628b795a56c66e9..4126aae55917040191517001b84bec26e4f1bda6 100644 (file)
@@ -1,3 +1,8 @@
+2004-01-05  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * Uri.cs : fixed IsBadFileSystemCharacter() to reject more characters
+         based on MS.NET experiment.
+
 2003-12-08  Atsushi Enomoto  <atsushi@ximian.com>
 
        * Uri.cs : more fixes. More presice UNC handling, opaque part 
index e5208cc2d004d227a8aac84c11436b3181f3b1ad..706527225ef54f58966c7a946260885aed37d3f3 100755 (executable)
@@ -957,9 +957,23 @@ namespace System
 
                protected virtual bool IsBadFileSystemCharacter (char ch)
                {
-                       foreach (char c in System.IO.Path.InvalidPathChars)
-                               if (c == ch)
-                                       return true;
+                       // It does not always overlap with InvalidPathChars.
+                       int chInt = (int) ch;
+                       if (chInt < 32 || (chInt < 64 && chInt > 57))
+                               return true;
+                       switch (chInt) {
+                       case 0:
+                       case 34: // "
+                       case 38: // &
+                       case 42: // *
+                       case 44: // ,
+                       case 47: // /
+                       case 92: // \
+                       case 94: // ^
+                       case 124: // |
+                               return true;
+                       }
+
                        return false;
                }