[epiphany] do not touch query parameter values when removing trackers



commit 77a7fd4cfdd5d1c02f83f1740f75da34b25fd84c
Author: Frédéric Péters <fpeters 0d be>
Date:   Thu Feb 20 17:01:49 2014 +0100

    do not touch query parameter values when removing trackers
    
    https://bugzilla.gnome.org/show_bug.cgi?id=724724

 lib/ephy-uri-helpers.c        |    6 ++++--
 tests/ephy-uri-helpers-test.c |    3 +++
 2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/lib/ephy-uri-helpers.c b/lib/ephy-uri-helpers.c
index 2d384ee..2697dfa 100644
--- a/lib/ephy-uri-helpers.c
+++ b/lib/ephy-uri-helpers.c
@@ -32,6 +32,8 @@
  * URI related functions, including functions to clean up URI.
  */
 
+/* QueryItem holds a query parameter name/value pair. The name is unescaped in
+ * query_decode() with form_decode(), the value is not altered. */
 typedef struct {
   char *name;
   char *value;
@@ -98,7 +100,7 @@ encode_pair (GString *str, const char *name, const char *value)
     g_string_append_c (str, '&');
   append_form_encoded (str, name);
   g_string_append_c (str, '=');
-  append_form_encoded (str, value);
+  g_string_append (str, value);
 }
 
 /* Adapted from soup_form_decode in libsoup */
@@ -121,7 +123,7 @@ query_decode (const char *query)
       value = eq + 1;
     } else
       value = NULL;
-    if (!value || !form_decode (name) || !form_decode (value)) {
+    if (!value || !form_decode (name)) {
       g_free (name);
       continue;
     }
diff --git a/tests/ephy-uri-helpers-test.c b/tests/ephy-uri-helpers-test.c
index 1d44b64..b17334b 100644
--- a/tests/ephy-uri-helpers-test.c
+++ b/tests/ephy-uri-helpers-test.c
@@ -44,6 +44,9 @@ test_ephy_uri_helpers_remove_tracking (void)
     { "http://www.test.com/?utm_source=feedburner";, "http://www.test.com/"; },
     { "http://www.test.com/?feature=foo";, "http://www.test.com/?feature=foo"; },
     { "http://foo.youtube.com/?feature=foo";, "http://foo.youtube.com/"; },
+    /* https://bugzilla.gnome.org/show_bug.cgi?id=724724 */
+    { "http://git.savannah.gnu.org/gitweb/?p=grep.git;a=commit;h=97318f5e59a1ef6feb8a378434a00932a3fc1e0b";,
+      "http://git.savannah.gnu.org/gitweb/?p=grep.git;a=commit;h=97318f5e59a1ef6feb8a378434a00932a3fc1e0b"},
   };
   guint i;
 


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