[Mono-bugs] [Bug 47691][Nor] Changed - incorrect file Uri path properties
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Fri, 11 Jun 2004 06:49: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.
http://bugzilla.ximian.com/show_bug.cgi?id=47691
--- shadow/47691 2004-06-10 16:41:29.000000000 -0400
+++ shadow/47691.tmp.29275 2004-06-11 06:49:13.000000000 -0400
@@ -188,6 +188,64 @@
------- Additional Comments From atsushi@ximian.com 2004-06-10 15:17 -------
Thanks, should be fixed in cvs.
------- Additional Comments From chris@turchin.net 2004-06-10 16:41 -------
works now. thanks atsushi!
+
+------- Additional Comments From atsushi@ximian.com 2004-06-11 06:49 -------
+I noticed that file URI must not disregard fragment identifier '#'. I
+retried on MS.NET and noticed that '#' is regarded as file name
+character only when constructed by absolute file path. My patch was
+wrong for pure file: scheme.
+
+As a quick summary, you can only use LocalPath directly. You cannot
+use AbsoluteUri; it is escaped.
+
+I wrote an example code:
+
+using System;
+
+public class Test
+{
+ public static void Main ()
+ {
+ Uri uri;
+
+ uri = new Uri ("file:///c:/cygwin/home/ginga/c#books");
+ DumpUri (uri);
+ uri = new Uri ("c:/cygwin/home/ginga/c#books");
+ DumpUri (uri);
+ uri = new Uri (new Uri
+("c:/cygwin/home/ginga/c#books"), "f#books");
+ DumpUri (uri);
+ }
+
+ public static void DumpUri (Uri uri)
+ {
+ Console.WriteLine ("localpath = [{0}]", uri.LocalPath);
+ Console.WriteLine ("abspath = [{0}]", uri.AbsolutePath);
+ }
+}
+
+The results were:
+
+./opaque.exe
+localpath = [c:\cygwin\home\ginga\c]
+abspath = [c:/cygwin/home/ginga/c]
+localpath = [c:\cygwin\home\ginga\c#books]
+abspath = [c:/cygwin/home/ginga/c%23books]
+localpath = [c:\cygwin\home\ginga\f]
+abspath = [c:/cygwin/home/ginga/f]
+
+The experiment above shows that LocalPath preserves '#', but
+AbsoluteUri does not preserve '#' and escapes it into "%23". I think
+we had better make Uri class to match with this behavior.
+
+Interestingly, on the third case, "f#books" is not recognized as a
+valid file path, but is regarded just as a fragment identifier. That
+means, we cannot create such file path from relative URI constructor.
+
+Note that we still have another bug with related to Unix file path:
+#58301.
+
+The fix for above is now checked in cvs.