[Mono-bugs] [Bug 63055][Nor] New - Bad uri construction in uri constructor

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 13 Aug 2004 15:17:18 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by azugaldia@yahoo.es.

http://bugzilla.ximian.com/show_bug.cgi?id=63055

--- shadow/63055	2004-08-13 15:17:18.000000000 -0400
+++ shadow/63055.tmp.9031	2004-08-13 15:17:18.000000000 -0400
@@ -0,0 +1,46 @@
+Bug#: 63055
+Product: Mono: Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: azugaldia@yahoo.es               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Bad uri construction in uri constructor
+
+In this example:
+
+using System;
+
+class Test {
+	static void Main () {
+		Uri uri1 = new Uri ("http://www.domain.org/dir1/dir2");
+		Uri uri2 = new Uri ("http://www.domain.org/dir1/dir2/");
+
+		string relative = "../file.txt";
+
+		Uri uri3 = new Uri (uri1, relative);
+		Uri uri4 = new Uri (uri2, relative);
+
+		Console.WriteLine ("{0} + {1} = {2}", uri1, relative, uri3); // Error
+		Console.WriteLine ("{0} + {1} = {2}", uri2, relative, uri4); // Correct
+	}
+}
+
+you'll get this result:
+
+http://www.domain.org/dir1/dir2 + ../file.txt = http://www.domain.org/file.txt
+http://www.domain.org/dir1/dir2/ + ../file.txt =
+http://www.domain.org/dir1/file.txt
+
+that means a strange/wrong behaviour in the first case (when the path
+doesn't end with a /). It seems the constructor thinks dir2 is a file, not
+a dir, in the first case.