[epiphany] ephy-embed-utils: Ensure that host name is in lower case
- From: Jan-Michael Brummer <jbrummer src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] ephy-embed-utils: Ensure that host name is in lower case
- Date: Mon, 17 Dec 2018 17:45:11 +0000 (UTC)
commit fdb131cbfded9c49d24d5ef33d926a870cd9145c
Author: Jan-Michael Brummer <jan brummer tabos org>
Date: Mon Dec 17 18:15:37 2018 +0100
ephy-embed-utils: Ensure that host name is in lower case
Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/230
embed/ephy-embed-utils.c | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/embed/ephy-embed-utils.c b/embed/ephy-embed-utils.c
index cda37d9b8..52ed15c41 100644
--- a/embed/ephy-embed-utils.c
+++ b/embed/ephy-embed-utils.c
@@ -304,11 +304,35 @@ ephy_embed_utils_autosearch_address (const char *search_key)
return effective_address;
}
+static char *
+ensure_host_name_is_lowercase (const char *address)
+{
+ g_autofree gchar *host = ephy_string_get_host_name (address);
+ g_autofree gchar *lowercase_host;
+ char *ret = NULL;
+
+ if (host == NULL) {
+ return g_strdup (address);
+ }
+
+ lowercase_host = g_utf8_strdown (host, -1);
+
+ if (strcmp (host, lowercase_host) != 0) {
+ ret = ephy_string_find_and_replace (address, host, lowercase_host);
+ } else {
+ ret = g_strdup (address);
+ }
+
+ return ret;
+}
+
char *
ephy_embed_utils_normalize_or_autosearch_address (const char *address)
{
- if (ephy_embed_utils_address_is_valid (address))
- return ephy_embed_utils_normalize_address (address);
+ g_autofree gchar *lower_case_address = ensure_host_name_is_lowercase (address);
+
+ if (ephy_embed_utils_address_is_valid (lower_case_address))
+ return ephy_embed_utils_normalize_address (lower_case_address);
else
return ephy_embed_utils_autosearch_address (address);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]