[libgdata] gd: Fix attribute escaping for GDataGDReminder
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata] gd: Fix attribute escaping for GDataGDReminder
- Date: Thu, 30 Sep 2010 18:19:13 +0000 (UTC)
commit 5b3ff1ead3f14cfd9e8cbfcacc617461e3115f4a
Author: Philip Withnall <philip tecnocode co uk>
Date: Thu Sep 30 19:05:13 2010 +0100
gd: Fix attribute escaping for GDataGDReminder
gdata/gd/gdata-gd-reminder.c | 2 +-
gdata/tests/general.c | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/gdata/gd/gdata-gd-reminder.c b/gdata/gd/gdata-gd-reminder.c
index fd760f7..331c0f9 100644
--- a/gdata/gd/gdata-gd-reminder.c
+++ b/gdata/gd/gdata-gd-reminder.c
@@ -303,7 +303,7 @@ pre_get_xml (GDataParsable *parsable, GString *xml_string)
}
if (priv->method != NULL)
- g_string_append_printf (xml_string, " method='%s'", priv->method);
+ gdata_parser_string_append_escaped (xml_string, " method='", priv->method, "'");
}
static void
diff --git a/gdata/tests/general.c b/gdata/tests/general.c
index 7d71368..e8de93b 100644
--- a/gdata/tests/general.c
+++ b/gdata/tests/general.c
@@ -2081,6 +2081,24 @@ test_gd_reminder (void)
}
static void
+test_gd_reminder_escaping (void)
+{
+ GDataGDReminder *reminder;
+ gchar *xml;
+
+ reminder = gdata_gd_reminder_new (GDATA_GD_REMINDER_ALERT "?foo&bar", NULL, 15);
+
+ /* Check the outputted XML is escaped properly */
+ xml = gdata_parsable_get_xml (GDATA_PARSABLE (reminder));
+ g_assert_cmpstr (xml, ==,
+ "<?xml version='1.0' encoding='UTF-8'?>"
+ "<gd:reminder xmlns='http://www.w3.org/2005/Atom' xmlns:gd='http://schemas.google.com/g/2005' "
+ "minutes='15' method='alert?foo&bar'/>");
+ g_free (xml);
+ g_object_unref (reminder);
+}
+
+static void
test_gd_when (void)
{
GDataGDWhen *when, *when2;
@@ -3225,6 +3243,7 @@ main (int argc, char *argv[])
g_test_add_func ("/gd/postal_address", test_gd_postal_address);
g_test_add_func ("/gd/postal_address/escaping", test_gd_postal_address_escaping);
g_test_add_func ("/gd/reminder", test_gd_reminder);
+ g_test_add_func ("/gd/reminder/escaping", test_gd_reminder_escaping);
g_test_add_func ("/gd/when", test_gd_when);
g_test_add_func ("/gd/where", test_gd_where);
g_test_add_func ("/gd/who", test_gd_who);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]