Dont unescape URIs which are not escaped

sokoke_uri_unescape_string handles that and handles '+'
the way we want.
This commit is contained in:
Alexander Butenko 2010-07-23 09:48:45 -04:00 committed by Christian Dywan
parent a770a1b488
commit f8bf87ecf9
3 changed files with 23 additions and 2 deletions

View file

@ -455,7 +455,8 @@ midori_location_action_popup_timeout_cb (gpointer data)
icon = action->default_icon;
if (type == 1 /* history_view */)
{
unescaped_uri = g_uri_unescape_string ((const char*)uri, "");
unescaped_uri = sokoke_uri_unescape_string ((const char*)uri);
gtk_list_store_insert_with_values (store, NULL, matches,
URI_COL, unescaped_uri, TITLE_COL, title, YALIGN_COL, 0.25,
FAVICON_COL, icon, -1);

View file

@ -737,6 +737,22 @@ sokoke_magic_uri (const gchar* uri)
return NULL;
}
/**
* sokoke_uri_unescape_string:
* @uri: an URI string
*
* Unescape @uri if needed, and pass through '+'.
*
* Return value: a newly allocated URI
**/
gchar*
sokoke_uri_unescape_string (const gchar* uri)
{
if (strchr (uri,'%'))
return g_uri_unescape_string (uri, "+");
return g_strdup (uri);
}
/**
* sokoke_format_uri_for_display:
* @uri: an URI string
@ -749,9 +765,10 @@ sokoke_magic_uri (const gchar* uri)
gchar*
sokoke_format_uri_for_display (const gchar* uri)
{
gchar* unescaped;
if (uri && g_str_has_prefix (uri, "http://"))
{
gchar* unescaped = g_uri_unescape_string (uri, "+");
gchar* unescaped = sokoke_uri_unescape_string (uri);
#ifdef HAVE_LIBSOUP_2_27_90
gchar* path = NULL;
gchar* hostname;

View file

@ -113,6 +113,9 @@ sokoke_uri_to_ascii (const gchar* uri);
gchar*
sokoke_magic_uri (const gchar* uri);
gchar*
sokoke_uri_unescape_string (const gchar* uri);
gchar*
sokoke_format_uri_for_display (const gchar* uri);