From 1d634247c7e013794a7d4c75843c0e926491b9d0 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Mon, 28 Sep 2009 23:01:48 +0200 Subject: [PATCH] Only if a preriod follws is a typed number the start of an IP address --- midori/sokoke.c | 4 ++-- tests/magic-uri.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/midori/sokoke.c b/midori/sokoke.c index 0032aaf1..bc169703 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -319,8 +319,8 @@ sokoke_magic_uri (const gchar* uri, if (g_strstr_len (uri, 8, "://")) return sokoke_idn_to_punycode (g_strdup (uri)); - /* Do we have a domain, ip address or localhost? */ - if (g_ascii_isdigit (uri[0])) + /* Do we have an IP address? */ + if (g_ascii_isdigit (uri[0]) && g_strstr_len (uri, 4, ".")) return g_strconcat ("http://", uri, NULL); search = NULL; if (!strchr (uri, ' ') && diff --git a/tests/magic-uri.c b/tests/magic-uri.c index db9ea4ee..38295f8b 100644 --- a/tests/magic-uri.c +++ b/tests/magic-uri.c @@ -114,6 +114,8 @@ magic_uri_search (void) test_input ("gtk2.0", NULL); test_input ("pcre++", NULL); test_input ("sm pcre++", SM "pcre%2B%2B"); + test_input ("5580", NULL); + test_input ("sm 5580", SM "5580"); test_input ("midori0.1.0", NULL); test_input ("midori 0.1.0", NULL); test_input ("search:cats", NULL);