Author: kostat
Date: 2007-03-26 07:13:04 -0500 (Mon, 26 Mar 2007)
New Revision: 74975
Modified:
trunk/mcs/class/System.Web/System.Web/ChangeLog
trunk/mcs/class/System.Web/System.Web/HttpRequest.cs
trunk/mcs/class/System.Web/Test/System.Web/HttpRequestTest.cs
Log:
correctly handle null and empty virtual pathes in MapPath
Modified: trunk/mcs/class/System.Web/System.Web/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web/ChangeLog 2007-03-26 12:04:03 UTC
(rev 74974)
+++ trunk/mcs/class/System.Web/System.Web/ChangeLog 2007-03-26 12:13:04 UTC
(rev 74975)
@@ -1,3 +1,7 @@
+2007-03-26 Konstantin Triger <[EMAIL PROTECTED]>
+
+ * HttpRequest.cs: correctly handle null and empty virtual pathes in
MapPath.
+
2007-03-25 Vladimir Krasnov <[EMAIL PROTECTED]>
* HttpContext.cs: AppGlobalResourcesAssembly static member stored in
Modified: trunk/mcs/class/System.Web/System.Web/HttpRequest.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web/HttpRequest.cs 2007-03-26
12:04:03 UTC (rev 74974)
+++ trunk/mcs/class/System.Web/System.Web/HttpRequest.cs 2007-03-26
12:13:04 UTC (rev 74975)
@@ -1113,10 +1113,13 @@
if (worker_request == null)
throw new HttpException ("No
HttpWorkerRequest");
- if (virtualPath == null || virtualPath == "")
- virtualPath = "";
- else
+ if (virtualPath == null)
+ virtualPath = "~";
+ else {
virtualPath = virtualPath.Trim ();
+ if (virtualPath.Length == 0)
+ virtualPath = "~";
+ }
if (virtualPath.IndexOf (':') != -1)
throw new ArgumentNullException (
Modified: trunk/mcs/class/System.Web/Test/System.Web/HttpRequestTest.cs
===================================================================
--- trunk/mcs/class/System.Web/Test/System.Web/HttpRequestTest.cs
2007-03-26 12:04:03 UTC (rev 74974)
+++ trunk/mcs/class/System.Web/Test/System.Web/HttpRequestTest.cs
2007-03-26 12:13:04 UTC (rev 74975)
@@ -177,6 +177,9 @@
HttpRequest r = HttpContext.Current.Request;
string appBase = r.PhysicalApplicationPath.TrimEnd
(Path.DirectorySeparatorChar);
Assert.AreEqual (appBase, r.MapPath ("~"), "test1");
+ Assert.AreEqual (appBase, r.MapPath (null), "test1a");
+ Assert.AreEqual (appBase, r.MapPath (""), "test1b");
+ Assert.AreEqual (appBase, r.MapPath (" "), "test1c");
Assert.AreEqual (appBase + Path.DirectorySeparatorChar,
r.MapPath ("~/"), "test1");
Assert.AreEqual (appBase, r.MapPath ("/NunitWeb"),
"test1.1");
Assert.AreEqual (Path.Combine (appBase, "Web.config"),
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches