[epiphany] ephy-string: Handle about: and ephy-about: as special cases in ephy_string_get_host_name()



commit 11d8b3ed3849e4ed18e9741af5ce316c4ccb29b8
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Fri Jan 11 09:11:11 2013 +0100

    ephy-string: Handle about: and ephy-about: as special cases in ephy_string_get_host_name()
    
    And return NULL like for file:// URIs.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=691416

 lib/ephy-string.c        |    6 +++++-
 tests/ephy-string-test.c |    2 ++
 2 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/lib/ephy-string.c b/lib/ephy-string.c
index 027c02a..54b8312 100644
--- a/lib/ephy-string.c
+++ b/lib/ephy-string.c
@@ -433,7 +433,11 @@ ephy_string_get_host_name (const char *url)
   SoupURI *uri;
   char *ret;
   
-  if (url == NULL || g_str_has_prefix (url, "file://")) return NULL;
+  if (url == NULL ||
+      g_str_has_prefix (url, "file://") ||
+      g_str_has_prefix (url, "about:") ||
+      g_str_has_prefix (url, "ephy-about:"))
+    return NULL;
 
   uri = soup_uri_new (url);
   /* If uri is NULL it's very possible that we just got
diff --git a/tests/ephy-string-test.c b/tests/ephy-string-test.c
index 6d407b0..bcb1aae 100644
--- a/tests/ephy-string-test.c
+++ b/tests/ephy-string-test.c
@@ -35,6 +35,8 @@ static const HostnameTest hostname_tests[] = {
   { "www.google.com", "www.google.com" },
   { "google.com", "google.com" },
   { "file:///tmp/", NULL },
+  { "about:blank", NULL },
+  { "ephy-about:applications", NULL },
   { NULL, NULL },
   { "garbage garbage", "garbage garbage" } /* FIXME: should this be NULL? */
 };



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]