tomboy r1929 - in trunk: . Tomboy/Addins/Evolution



Author: btimothy
Date: Mon Mar  3 16:13:10 2008
New Revision: 1929
URL: http://svn.gnome.org/viewvc/tomboy?rev=1929&view=rev

Log:
* Tomboy/Addins/Evolution/EvolutionNoteAddin.cs: Patch from Stefan
  Cosma to Uri.Unescape and then Uri.Escape the mail path to ensure
  we've got the entire string escaped properly.  Fixes bug #367623.

Modified:
   trunk/ChangeLog
   trunk/Tomboy/Addins/Evolution/EvolutionNoteAddin.cs

Modified: trunk/Tomboy/Addins/Evolution/EvolutionNoteAddin.cs
==============================================================================
--- trunk/Tomboy/Addins/Evolution/EvolutionNoteAddin.cs	(original)
+++ trunk/Tomboy/Addins/Evolution/EvolutionNoteAddin.cs	Mon Mar  3 16:13:10 2008
@@ -89,26 +89,6 @@
 		}
 
 		//
-		// Duplicates evoluion/camel/camel-url.c:camel_url_encode and
-		// escapes ";?" as well.
-		//
-		static string CamelUrlEncode (string uri_part)
-		{
-			// The characters Camel encodes
-			const string camel_escape_chars = " \"%#<>{}|\\^[]`;?";
-
-			StringBuilder builder = new StringBuilder (null);
-			foreach (char c in uri_part) {
-				if (camel_escape_chars.IndexOf (c) > -1)
-					builder.Append (Uri.HexEscape (c));
-				else
-					builder.Append (c);
-			}
-
-			return builder.ToString ();
-		}
-
-		//
 		// Duplicates
 		// evolution/mail/mail-config.c:mail_config_get_account_by_source_url...
 		//
@@ -205,7 +185,11 @@
 			if (path != string.Empty) {
 				// Skip leading '/' or '#'...
 				path = path.Substring (1);
-				path = CamelUrlEncode (path);
+				
+				// Some of the special characters in path are escaped (ex: " ",
+				// "%", ...) but other like ";" and "?" are not. This ensures
+				// that all special characters are escaped.
+				path = Uri.EscapeDataString (Uri.UnescapeDataString (path));
 			}
 
 			return string.Format ("email://{0}/{1}", account_uid, path);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]