[geary/wip/742429-escaping] HTML escape email addresses in conversation viewer header: Bug #742429
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/742429-escaping] HTML escape email addresses in conversation viewer header: Bug #742429
- Date: Wed, 7 Jan 2015 00:06:13 +0000 (UTC)
commit addeed80a111ab1c5755ce1a078edad6f7b6d60c
Author: Jim Nelson <jim yorba org>
Date: Tue Jan 6 16:02:47 2015 -0800
HTML escape email addresses in conversation viewer header: Bug #742429
Email address such as ["<S dude example com>" <s dude example com>]
was not being escaped for HTML, so the S tag would strike-out the
remaining text in the address line. This patch corrects that.
While working on this, I noticed as well that the mailto: link was not
being properly formed due to lack of quoting. By using
MailboxAddress.to_rfc822_string(), problem solved.
.../conversation-viewer/conversation-viewer.vala | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-viewer.vala
b/src/client/conversation-viewer/conversation-viewer.vala
index 5bb4847..be3dce6 100644
--- a/src/client/conversation-viewer/conversation-viewer.vala
+++ b/src/client/conversation-viewer/conversation-viewer.vala
@@ -2039,17 +2039,15 @@ public class ConversationViewer : Gtk.Box {
string value = "";
Gee.List<Geary.RFC822.MailboxAddress> list = addresses.get_all();
foreach (Geary.RFC822.MailboxAddress a in list) {
- if (a.name != null) {
- value += "<a href='mailto:%s'>".printf(
- Uri.escape_string("%s <%s>".printf(a.name, a.address)));
- value += "<span class='address_name'>%s</span> ".printf(a.name);
- value += "<span class='address_value'>%s</span>".printf(a.address);
+ value += "<a href='mailto:%s'>".printf(Uri.escape_string(a.to_rfc822_string()));
+ if (!Geary.String.is_empty(a.name)) {
+ value += "<span class='address_name'>%s</span> ".printf(Geary.HTML.escape_markup(a.name));
+ value += "<span class='address_value'>%s</span>".printf(Geary.HTML.escape_markup(a.address));
} else {
- value += "<a href='mailto:%s'>".printf(a.address);
- value += "<span class='address_name'>%s</span>".printf(a.address);
+ value += "<span class='address_name'>%s</span>".printf(Geary.HTML.escape_markup(a.address));
}
value += "</a>";
-
+
if (++i < list.size)
value += ", ";
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]