diff options
author | Daniel Carl <danielcarl@gmx.de> | 2019-03-25 00:07:52 +0100 |
---|---|---|
committer | Daniel Carl <danielcarl@gmx.de> | 2019-03-25 00:17:46 +0100 |
commit | d18c51fdf0f99ebbe78d916032fcbbf7cdec4b25 (patch) | |
tree | a92e0d086feba8457f2dfc1716e87c187073a7ba /src/util.c | |
parent | 34dce1c5d2ad4d4eb94e863358250a6053eff7dc (diff) |
Use webkit_uri_for_display().
Use this function for shown url for IDN homograph mitigation.
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -827,16 +827,24 @@ char *util_sanitize_uri(const char *uri_str) { SoupURI *uri; char *sanitized_uri; + char *for_display; + +#if WEBKIT_CHECK_VERSION(2, 24, 0) + for_display = webkit_uri_for_display(uri_str); +#else + for_display = g_strdup(uri_str); +#endif /* Sanitize the uri only in case there is a @ which might be the indicator * for credentials used in uri. */ - if (!strchr(uri_str, '@')) { - return g_strdup(uri_str); + if (!strchr(for_display, '@')) { + return for_display; } - uri = soup_uri_new(uri_str); + uri = soup_uri_new(for_display); sanitized_uri = soup_uri_to_string(uri, FALSE); soup_uri_free(uri); + g_free(for_display); return sanitized_uri; } |