[Mono-bugs] [Bug 51313][Nor] New - Uri.LocalPath returns invalid path for relative paths

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 27 May 2004 15:37:13 -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 atsushi@ximian.com.


--- shadow/51313	2004-05-27 15:37:13.000000000 -0400
+++ shadow/51313.tmp.1403	2004-05-27 15:37:13.000000000 -0400
@@ -0,0 +1,67 @@
+Bug#: 51313
+Product: Mono: Class Libraries
+Version: unspecified
+OS: unknown
+OS Details: 
+Status: RESOLVED   
+Resolution: NOTABUG
+Severity: Unknown
+Priority: Normal
+Component: CORLIB
+AssignedTo: rkumar@novell.com                            
+ReportedBy: gert.driesen@pandora.be               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: Uri.LocalPath returns invalid path for relative paths
+The System.Uri class does not deal correctly with the following relative
+paths :
+An URI starting with ./ or ../ is considered as a valid file URI, but the
+LocalPath property does not return a path that corresponds with the
+original URI.
+eg. ./testfile will become //./testfile
+Apparently MS.NET does not consider a path starting with .\ or ..\ a valid
+uri (and throws an exception in this case), but Mono does.  This is not a
+problem by itself, if the LocalPath property would return a valid path that
+actually corresponds with the URI.
+I attached a repro that demonstrates this behaviour.
+------- Additional Comments From gert.driesen@pandora.be  2003-11-23 15:20 -------
+Created an attachment (id=5995)
+repro that demonstrates the issue
+------- Additional Comments From ginga@kit.hi-ho.ne.jp  2003-12-15 10:51 -------
+As far as I tried MS.NET 1.1, System.Uri is not designed to allow 
+relative URI as its argument. To specify relative URI, 
+- you have to pass "base URI" for another constructor new Uri (Uri 
+baseUri, string relativeUri), or
+- you have to wait for .NET 1.2, which has another constructor new 
+Uri (string uriString, bool dontEscape, bool allowRelativeUri).
+Of course System.Uri does not give the same results as MS.NET, but I 
+think its design principle is not to allow relative URI here.
+------- Additional Comments From atsushi@ximian.com  2004-05-27 15:37 -------
+mmm, I wonder why it is "REOPENED" (at least looking at BUG Activity
+log). Well, now I close it with MS's stack trace for the test case,
+instead of my ambiguous comment.
+Unhandled Exception: System.UriFormatException: Invalid URI: The
+format of the URI could not be determined.
+   at System.Uri.Parse()
+   at System.Uri..ctor(String uriString, Boolean dontEscape)
+   at System.Uri..ctor(String uriString)
+   at Mono.UriTest.Main()