diff --git a/midori/sokoke.c b/midori/sokoke.c index b0620673..7ea9b830 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -125,7 +125,8 @@ sokoke_magic_uri (const gchar* uri, { search = NULL; if (!(parts[1][1] == '\0' && !g_ascii_isalpha (parts[1][0]))) - search = g_strconcat ("http://", uri, NULL); + if (!strchr (parts[0], ' ') && !strchr (parts[1], ' ')) + search = g_strconcat ("http://", uri, NULL); g_free (parts); if (search) return search; diff --git a/tests/magic-uri.c b/tests/magic-uri.c index 5623f200..18bfa86e 100644 --- a/tests/magic-uri.c +++ b/tests/magic-uri.c @@ -44,6 +44,7 @@ main (int argc, return 1; \ } \ g_free (uri) +#define SM "http://www.searchmash.com/search/" test_input ("ftp://ftp.mozilla.org", "ftp://ftp.mozilla.org"); test_input ("ftp://ftp.mozilla.org/pub", "ftp://ftp.mozilla.org/pub"); @@ -61,8 +62,8 @@ main (int argc, test_input ("localhost:8000", "http://localhost:8000"); test_input ("192.168.1.1", "http://192.168.1.1"); test_input ("192.168.1.1:8000", "http://192.168.1.1:8000"); - test_input ("sm midori", "http://www.searchmash.com/search/midori"); - test_input ("sm cats dogs", "http://www.searchmash.com/search/cats dogs"); + test_input ("sm midori", SM "midori"); + test_input ("sm cats dogs", SM "cats dogs"); test_input ("dict midori", NULL); test_input ("cats", NULL); test_input ("cats dogs", NULL); @@ -74,7 +75,14 @@ main (int argc, test_input ("search:twotoasts.de", NULL); test_input ("g cache:127.0.0.1", NULL); test_input ("g cache:127.0.0.1/foo", NULL); - test_input ("g cache:twotoats.de/foo", NULL); + test_input ("g cache:twotoasts.de/foo", NULL); + test_input ("sm cache:127.0.0.1", SM "cache:127.0.0.1"); + test_input ("sm cache:127.0.0.1/foo", SM "cache:127.0.0.1/foo"); + test_input ("sm cache:twotoasts.de/foo", SM "cache:twotoasts.de/foo"); + test_input ("de.po verbose", NULL); + test_input ("verbose de.po", NULL); + test_input ("g de.po verbose", NULL); + test_input ("sm de.po verbose", SM "de.po verbose"); return 0; }