Percent encode search terms, so '+' actually ends up as a '+'
This commit is contained in:
parent
52084a21e1
commit
d7d6edbff3
3 changed files with 15 additions and 6 deletions
|
@ -2547,10 +2547,15 @@ _action_location_submit_uri (GtkAction* action,
|
|||
gint n;
|
||||
|
||||
new_uri = sokoke_magic_uri (uri, browser->search_engines);
|
||||
if (!new_uri && strstr (browser->location_entry_search, "%s"))
|
||||
new_uri = g_strdup_printf (browser->location_entry_search, uri);
|
||||
if (!new_uri)
|
||||
{
|
||||
gchar* uri_ = g_uri_escape_string (uri, " :/", TRUE);
|
||||
if (strstr (browser->location_entry_search, "%s"))
|
||||
new_uri = g_strdup_printf (browser->location_entry_search, uri_);
|
||||
else if (!new_uri)
|
||||
new_uri = g_strconcat (browser->location_entry_search, uri, NULL);
|
||||
new_uri = g_strconcat (browser->location_entry_search, uri_, NULL);
|
||||
g_free (uri_);
|
||||
}
|
||||
|
||||
if (new_tab)
|
||||
{
|
||||
|
|
|
@ -279,11 +279,13 @@ sokoke_magic_uri (const gchar* uri,
|
|||
if (parts[0] && parts[1])
|
||||
if ((item = katze_array_find_token (search_engines, parts[0])))
|
||||
{
|
||||
gchar* uri_ = g_uri_escape_string (parts[1], " :/", TRUE);
|
||||
search_uri = katze_item_get_uri (item);
|
||||
if (strstr (search_uri, "%s"))
|
||||
search = g_strdup_printf (search_uri, parts[1]);
|
||||
search = g_strdup_printf (search_uri, uri_);
|
||||
else
|
||||
search = g_strdup_printf ("%s%s", search_uri, parts[1]);
|
||||
search = g_strconcat (search_uri, uri_, NULL);
|
||||
g_free (uri_);
|
||||
}
|
||||
g_strfreev (parts);
|
||||
return search;
|
||||
|
|
|
@ -117,6 +117,8 @@ magic_uri_search (void)
|
|||
test_input ("cats dogs", NULL);
|
||||
test_input ("gtk 2.0", NULL);
|
||||
test_input ("gtk2.0", NULL);
|
||||
test_input ("pcre++", NULL);
|
||||
test_input ("sm pcre++", SM "pcre%2B%2B");
|
||||
test_input ("midori0.1.0", NULL);
|
||||
test_input ("midori 0.1.0", NULL);
|
||||
test_input ("search:cats", NULL);
|
||||
|
|
Loading…
Reference in a new issue