aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVitaly Minko <vitaly.mink@gmail.com>2010-11-02 17:08:15 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-11-02 17:08:15 +0800
commit0c927779b5b37ba01bb710b86e21c55f35e7ad94 (patch)
tree58f90d4e91643fb57019d7b39c1e4a477b894c1b
parentdff6d4ec7292db208dac8abf44a238764b1e3915 (diff)
downloadgsoc2013-empathy-0c927779b5b37ba01bb710b86e21c55f35e7ad94.tar
gsoc2013-empathy-0c927779b5b37ba01bb710b86e21c55f35e7ad94.tar.gz
gsoc2013-empathy-0c927779b5b37ba01bb710b86e21c55f35e7ad94.tar.bz2
gsoc2013-empathy-0c927779b5b37ba01bb710b86e21c55f35e7ad94.tar.lz
gsoc2013-empathy-0c927779b5b37ba01bb710b86e21c55f35e7ad94.tar.xz
gsoc2013-empathy-0c927779b5b37ba01bb710b86e21c55f35e7ad94.tar.zst
gsoc2013-empathy-0c927779b5b37ba01bb710b86e21c55f35e7ad94.zip
Escape URL itself along with the title (#616339)
-rw-r--r--libempathy-gtk/empathy-string-parser.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/libempathy-gtk/empathy-string-parser.c b/libempathy-gtk/empathy-string-parser.c
index 3bb6a82be..5f5df5209 100644
--- a/libempathy-gtk/empathy-string-parser.c
+++ b/libempathy-gtk/empathy-string-parser.c
@@ -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