diff --git a/midori/sokoke.c b/midori/sokoke.c index 2071f734..54f946e8 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -187,7 +187,12 @@ sokoke_magic_uri (const gchar* uri, } g_free (parts); if (search_uri) - search = g_strdup_printf (search_uri, parts[1]); + { + if (strstr (search_uri, "%s")) + search = g_strdup_printf (search_uri, parts[1]); + else + search = g_strdup_printf ("%s%s", search_uri, parts[1]); + } return search; } return g_strdup (uri); diff --git a/tests/magic-uri.c b/tests/magic-uri.c index 7fda317a..5192fac3 100644 --- a/tests/magic-uri.c +++ b/tests/magic-uri.c @@ -32,6 +32,12 @@ main (int argc, "uri", "http://www.searchmash.com/search/%s", "token", "sm", NULL); katze_array_add_item (search_engines, item); + g_object_unref (item); + item = g_object_new (KATZE_TYPE_ITEM, + "uri", "http://www.searchmash.com/search/", + "token", "se", NULL); + katze_array_add_item (search_engines, item); + g_object_unref (item); #define test_input(input, expected) \ uri = sokoke_magic_uri (input, search_engines); \ @@ -65,6 +71,7 @@ main (int argc, test_input ("192.168.1.1:8000", "http://192.168.1.1:8000"); test_input ("sm midori", SM "midori"); test_input ("sm cats dogs", SM "cats dogs"); + test_input ("se cats dogs", SM "cats dogs"); test_input ("dict midori", NULL); test_input ("cats", NULL); test_input ("cats dogs", NULL);