[evolution] Fix displaying photos in contacts preview



commit 255e0529040baae67e3d70f1030ce248fd61856d
Author: Dan VrÃtil <dvratil redhat com>
Date:   Wed Jun 27 13:50:54 2012 +0200

    Fix displaying photos in contacts preview
    
    EContactPhoto URIs are already escaped, but WebKit escapes it again, so images
    are not displayed sometimes. Unescaping the URI before writing it to the HTML
    fixes to problem.

 addressbook/gui/widgets/eab-contact-formatter.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/addressbook/gui/widgets/eab-contact-formatter.c b/addressbook/gui/widgets/eab-contact-formatter.c
index cc4988d..43d68b1 100644
--- a/addressbook/gui/widgets/eab-contact-formatter.c
+++ b/addressbook/gui/widgets/eab-contact-formatter.c
@@ -421,10 +421,11 @@ render_title_block (EABContactFormatter *formatter,
 			photo_data);
 	} else if (photo && photo->type == E_CONTACT_PHOTO_TYPE_URI && photo->data.uri && *photo->data.uri) {
 		gboolean is_local = g_str_has_prefix (photo->data.uri, "file://");
-
+		gchar *unescaped = g_uri_unescape_string (photo->data.uri, NULL);
 		g_string_append_printf (
 			buffer, "<img border=\"1\" src=\"%s%s\">",
-			is_local ? "evo-" : "", photo->data.uri);
+			is_local ? "evo-" : "", unescaped);
+		g_free (unescaped);
 	}
 
 	if (photo)
@@ -878,11 +879,13 @@ render_compact (EABContactFormatter *formatter,
 		if (photo->type == E_CONTACT_PHOTO_TYPE_URI &&
 			photo->data.uri && *photo->data.uri) {
 			gboolean is_local = g_str_has_prefix (photo->data.uri, "file://");
+			gchar *unescaped = g_uri_unescape_string (photo->data.uri, NULL);
 			g_string_append_printf (
 				buffer,
 				"<img width=\"%d\" height=\"%d\" src=\"%s%s\">",
 				calced_width, calced_height,
-				is_local ? "evo-" : "", photo->data.uri);
+				is_local ? "evo-" : "", unescaped);
+			g_free (unescaped);
 		} else {
 			gchar *photo_data;
 



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