Only if a preriod follws is a typed number the start of an IP address

This commit is contained in:
Christian Dywan 2009-09-28 23:01:48 +02:00
parent 96093d9067
commit 1d634247c7
2 changed files with 4 additions and 2 deletions

View file

@ -319,8 +319,8 @@ sokoke_magic_uri (const gchar* uri,
if (g_strstr_len (uri, 8, "://")) if (g_strstr_len (uri, 8, "://"))
return sokoke_idn_to_punycode (g_strdup (uri)); return sokoke_idn_to_punycode (g_strdup (uri));
/* Do we have a domain, ip address or localhost? */ /* Do we have an IP address? */
if (g_ascii_isdigit (uri[0])) if (g_ascii_isdigit (uri[0]) && g_strstr_len (uri, 4, "."))
return g_strconcat ("http://", uri, NULL); return g_strconcat ("http://", uri, NULL);
search = NULL; search = NULL;
if (!strchr (uri, ' ') && if (!strchr (uri, ' ') &&

View file

@ -114,6 +114,8 @@ magic_uri_search (void)
test_input ("gtk2.0", NULL); test_input ("gtk2.0", NULL);
test_input ("pcre++", NULL); test_input ("pcre++", NULL);
test_input ("sm pcre++", SM "pcre%2B%2B"); 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 ("midori0.1.0", NULL);
test_input ("midori 0.1.0", NULL); test_input ("midori 0.1.0", NULL);
test_input ("search:cats", NULL); test_input ("search:cats", NULL);