[Mono-bugs] [Bug 37505][Wis] New - Uri.LocalPath doesn't unescape character encodings

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Sat, 1 Feb 2003 02:00:58 -0500 (EST)


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 tum@veridicus.com.

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

--- shadow/37505	Sat Feb  1 02:00:58 2003
+++ shadow/37505.tmp.11414	Sat Feb  1 02:00:58 2003
@@ -0,0 +1,74 @@
+Bug#: 37505
+Product: Mono/MCS
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: tum@veridicus.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Uri.LocalPath doesn't unescape character encodings
+
+Description of Problem:
+
+The property System.Uri.LocalPath should unescape the UNC paths.
+
+Steps to reproduce the problem:
+
+Examine the following code:
+
+// If testing under linux, just use any path with a space.
+Uri uri = new Uri("c:\\hello world.txt");
+
+// Should output c:\hello world.txt
+Console.WriteLine(uri.LocalPath);
+
+// Should output c:\hello%20world.txt
+Console.WriteLine(uri.AbsolutePath);
+
+Actual Results:
+
+c:\hello%20world.txt
+c:\hello%20world.txt
+
+Expected Results:
+
+c:\hello world.txt
+c:\hello%20world.txt
+
+How often does this happen? 
+
+All the time.
+
+Additional Information:
+
+Here's the patch:
+
+? patch
+Index: Uri.cs
+===================================================================
+RCS file: /mono/mcs/class/System/System/Uri.cs,v
+retrieving revision 1.13
+diff -r1.13 Uri.cs
+292c292
+< 					return path.Replace ('/', '\\');
+---
+> 					return Unescape(path.Replace
+('/','\\'));
+295c295
+< 					return "\\\\" + host + 
+path.Replace ('/', '\\');
+---
+> 					return Unescape("\\\\" + host + 
+path.Replace ('/', '\\'));
+297c297
+< 					return "/" + host + path;
+---
+> 					return Unescape("/" + host + path);