[Xfce4-commits] r23633 - in libexo/trunk: . exo

Benedikt Meurer benny at xfce.org
Sat Nov 4 12:03:17 CET 2006


Author: benny
Date: 2006-11-04 11:03:16 +0000 (Sat, 04 Nov 2006)
New Revision: 23633

Modified:
   libexo/trunk/ChangeLog
   libexo/trunk/exo/exo-url.c
Log:
2006-11-04	Benedikt Meurer <benny at xfce.org>

	* exo/exo-url.c(exo_url_show_on_screen): Need to escape commata in
	  URLs passed to web browsers and mail readers, because some of them,
	  i.e. Firefox and Thunderbird, will otherwise strip offs the part
	  after the last comma. Bug #2454.




Modified: libexo/trunk/ChangeLog
===================================================================
--- libexo/trunk/ChangeLog	2006-11-04 10:55:42 UTC (rev 23632)
+++ libexo/trunk/ChangeLog	2006-11-04 11:03:16 UTC (rev 23633)
@@ -1,3 +1,10 @@
+2006-11-04	Benedikt Meurer <benny at xfce.org>
+
+	* exo/exo-url.c(exo_url_show_on_screen): Need to escape commata in
+	  URLs passed to web browsers and mail readers, because some of them,
+	  i.e. Firefox and Thunderbird, will otherwise strip offs the part
+	  after the last comma. Bug #2454.
+
 2006-11-03	Benedikt Meurer <benny at xfce.org>
 
 	* exo/exo-url.c: Underscore is a valid character for usernames.

Modified: libexo/trunk/exo/exo-url.c
===================================================================
--- libexo/trunk/exo/exo-url.c	2006-11-04 10:55:42 UTC (rev 23632)
+++ libexo/trunk/exo/exo-url.c	2006-11-04 11:03:16 UTC (rev 23633)
@@ -202,6 +202,7 @@
 {
   const gchar *category = NULL;
   gboolean     result;
+  GString     *escaped_url;
   gchar       *display_name;
   gchar       *local_path;
   gchar       *command;
@@ -315,8 +316,22 @@
       return result;
     }
 
+  /* need to escape commata, otherwise firefox and several other helpers cannot handle the URL,
+   * see http://bugzilla.xfce.org/show_bug.cgi?id=2454 for a description of the problem.
+   */
+  escaped_url = g_string_sized_new (128);
+  for (; *url != '\0'; ++url)
+    {
+      if (*url == ',')
+        g_string_append (escaped_url, "%2C");
+      else
+        g_string_append_c (escaped_url, *url);
+    }
+
   /* oki doki then, let's open it */
-  return exo_execute_preferred_application_on_screen (category, url, NULL, envp, screen, error);
+  result = exo_execute_preferred_application_on_screen (category, escaped_url->str, NULL, envp, screen, error);
+  g_string_free (escaped_url, TRUE);
+  return result;
 }
 
 



More information about the Xfce4-commits mailing list