aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustavo Noronha Silva <gns@gnome.org>2009-10-04 19:55:49 +0800
committerGustavo Noronha Silva <gns@gnome.org>2009-10-07 18:16:32 +0800
commiteb4d86050b88de7b29ff07ee59780994f02cc3cf (patch)
tree5104d2099ace181d0caa8f06d37cd347df1df049
parentc7c283796e76a98571e89c28b9b936ac39420acc (diff)
downloadgsoc2013-epiphany-eb4d86050b88de7b29ff07ee59780994f02cc3cf.tar
gsoc2013-epiphany-eb4d86050b88de7b29ff07ee59780994f02cc3cf.tar.gz
gsoc2013-epiphany-eb4d86050b88de7b29ff07ee59780994f02cc3cf.tar.bz2
gsoc2013-epiphany-eb4d86050b88de7b29ff07ee59780994f02cc3cf.tar.lz
gsoc2013-epiphany-eb4d86050b88de7b29ff07ee59780994f02cc3cf.tar.xz
gsoc2013-epiphany-eb4d86050b88de7b29ff07ee59780994f02cc3cf.tar.zst
gsoc2013-epiphany-eb4d86050b88de7b29ff07ee59780994f02cc3cf.zip
Encode the typed URL before passing it as a query string for searching
This change makes sure that all characters that are typed make it to the search query. Thanks to Dan Winship for pointing out the solution. Bug #596717
-rw-r--r--embed/ephy-web-view.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 3d16eab0a..acf3e5f0b 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -1110,9 +1110,12 @@ ephy_web_view_load_url (EphyWebView *view,
/* If the string doesn't look like an URI, let's search it; */
if (soup_uri == NULL &&
priv->non_search_regex &&
- !g_regex_match (priv->non_search_regex, url, 0, NULL))
- effective_url = g_strdup_printf (_("http://www.google.com/search?q=%s&ie=UTF-8&oe=UTF-8"), url);
- else
+ !g_regex_match (priv->non_search_regex, url, 0, NULL)) {
+ char *query_param = soup_form_encode ("q", url, NULL);
+ /* + 2 here is getting rid of 'q=' */
+ effective_url = g_strdup_printf (_("http://www.google.com/search?q=%s&ie=UTF-8&oe=UTF-8"), query_param + 2);
+ g_free (query_param);
+ } else
effective_url = ephy_embed_utils_normalize_address (url);
webkit_web_view_open (WEBKIT_WEB_VIEW (view), effective_url);