[Xfce4-commits] <midori:master> Only if a preriod follws is a typed number the start of an IP address

Christian Dywan noreply at xfce.org
Mon Sep 28 23:12:01 CEST 2009


Updating branch refs/heads/master
         to 1d634247c7e013794a7d4c75843c0e926491b9d0 (commit)
       from 96093d906754a986ef9b6dae5eae0ba8411653d4 (commit)

commit 1d634247c7e013794a7d4c75843c0e926491b9d0
Author: Christian Dywan <christian at twotoasts.de>
Date:   Mon Sep 28 23:01:48 2009 +0200

    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 0032aaf..bc16970 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 db9ea4e..38295f8 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);



More information about the Xfce4-commits mailing list