]> git.0d.be Git - empathy.git/commitdiff
Escape URL itself along with the title (#616339)
authorVitaly Minko <vitaly.mink@gmail.com>
Tue, 2 Nov 2010 09:08:15 +0000 (10:08 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 2 Nov 2010 09:08:15 +0000 (10:08 +0100)
libempathy-gtk/empathy-string-parser.c

index 3bb6a82beb0af5a72aff628566a2a5b0c5217fb8..5f5df5209c01cb25db607cf0452afbe2996081cc 100644 (file)
@@ -161,20 +161,24 @@ empathy_string_replace_link (const gchar *text,
 {
        GString *string = user_data;
        gchar *real_url;
-       gchar *escaped;
+       gchar *title;
+       gchar *markup;
 
        real_url = empathy_make_absolute_url_len (text, len);
 
-       /* The thing we are making a link of may contain
-        * characters which need escaping */
-       escaped = g_markup_escape_text (text, len);
+       /* Need to copy manually, because g_markup_printf_escaped does not work
+        * with string precision pitfalls. */
+       title = g_strndup (text, len);
 
        /* Append the link inside <a href=""></a> tag */
-       g_string_append_printf (string, "<a href=\"%s\">%s</a>",
-                               real_url, escaped);
+       markup = g_markup_printf_escaped ("<a href=\"%s\">%s</a>",
+                       real_url, title);
+
+       g_string_append (string, markup);
 
        g_free (real_url);
-       g_free (escaped);
+       g_free (title);
+       g_free (markup);
 }
 
 void