]> spindle.queued.net Git - midori/commitdiff
Catch failure to unescape Uris and don't escape ' ' or '+'
authorChristian Dywan <christian@twotoasts.de>
Fri, 20 Nov 2009 19:33:51 +0000 (20:33 +0100)
committerChristian Dywan <christian@twotoasts.de>
Sat, 21 Nov 2009 01:35:14 +0000 (02:35 +0100)
midori/sokoke.c

index 17993b8b8ef17c46e7accfa1871d003635355b8a..7364f94f907a71af8524aea64e0232349e94cbb6 100644 (file)
@@ -458,11 +458,17 @@ sokoke_format_uri_for_display (const gchar* uri)
 {
     if (uri && g_str_has_prefix (uri, "http://"))
     {
-        gchar* unescaped = g_uri_unescape_string (uri, NULL);
+        gchar* unescaped = g_uri_unescape_string (uri, " +");
         #ifdef HAVE_LIBSOUP_2_27_90
         gchar* path;
-        gchar* hostname = sokoke_hostname_from_uri (unescaped, &path);
-        gchar* decoded = g_hostname_to_unicode (hostname);
+        gchar* hostname;
+        gchar* decoded;
+
+        if (!unescaped)
+            return g_strdup (uri);
+
+        hostname = sokoke_hostname_from_uri (unescaped, &path);
+        decoded = g_hostname_to_unicode (hostname);
 
         if (decoded)
         {
@@ -476,6 +482,10 @@ sokoke_format_uri_for_display (const gchar* uri)
         return unescaped;
         #elif HAVE_LIBIDN
         gchar* decoded;
+
+        if (!unescaped)
+            return g_strdup (uri);
+
         if (!idna_to_unicode_8z8z (unescaped, &decoded, 0) == IDNA_SUCCESS)
             return unescaped;
         g_free (unescaped);