[gnome-software/wip/ubuntu-xenial] Escape report fields correctly



commit f3d29cf4937e206e9f6616af1776680e725cf7b3
Author: Robert Ancell <robert ancell canonical com>
Date:   Fri Jul 1 15:01:28 2016 +1200

    Escape report fields correctly

 src/plugins/gs-plugin-ubuntu-reviews.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/gs-plugin-ubuntu-reviews.c b/src/plugins/gs-plugin-ubuntu-reviews.c
index 23e5382..eb2eb13 100644
--- a/src/plugins/gs-plugin-ubuntu-reviews.c
+++ b/src/plugins/gs-plugin-ubuntu-reviews.c
@@ -932,6 +932,8 @@ gs_plugin_review_report (GsPlugin *plugin,
                         GError **error)
 {
        const gchar *review_id;
+       g_autofree gchar *reason = NULL;
+       g_autofree gchar *text = NULL;
        g_autofree gchar *path = NULL;
 
        /* Can only modify Ubuntu reviews */
@@ -943,8 +945,10 @@ gs_plugin_review_report (GsPlugin *plugin,
                return FALSE;
 
        /* Create message for reviews.ubuntu.com */
-       // FIXME: escape reason / text properly
-       path = g_strdup_printf ("/api/1.0/reviews/%s/recommendations/?reason=%s&text=%s", review_id, "FIXME: 
gnome-software", "FIXME: gnome-software");
+       reason = soup_uri_encode ("FIXME: gnome-software", NULL);
+       text = soup_uri_encode ("FIXME: gnome-software", NULL);
+       path = g_strdup_printf ("/api/1.0/reviews/%s/recommendations/?reason=%s&text=%s",
+                               review_id, reason, text);
        if (!send_review_request (plugin, SOUP_METHOD_POST, path,
                                  NULL, TRUE,
                                  NULL, cancellable, error))


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