From 5120ad94e7003841a03189d334576bfe45406408 Mon Sep 17 00:00:00 2001 From: Diego Escalante Urrelo Date: Wed, 13 Jan 2010 11:54:43 -0500 Subject: Escape the name of resources before saving them Some resources might be of the style "page.php?orig=/place/other", this would make Epiphany crash while saving them because of the invalid characters for the filename. To solve this we escape the name of the resources before using it as the name of the destination file. Bug #606876 --- embed/ephy-web-view.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c index 7a0f9211d..62941358f 100644 --- a/embed/ephy-web-view.c +++ b/embed/ephy-web-view.c @@ -3345,6 +3345,7 @@ ephy_web_view_save_sub_resource_start (GList *subresources, char *destination_ur WebKitWebResource *resource; GFile *file; const char *resource_uri; + char *resource_basename; char *resource_name; char *resource_dest_uri; const GString *data; @@ -3352,11 +3353,12 @@ ephy_web_view_save_sub_resource_start (GList *subresources, char *destination_ur resource = WEBKIT_WEB_RESOURCE (subresources->data); resource_uri = webkit_web_resource_get_uri (resource); - resource_name = g_path_get_basename (resource_uri); + resource_basename = g_path_get_basename (resource_uri); - resource_dest_uri = g_strdup_printf ("%s/%s", - destination_uri, - resource_name); + resource_name = g_uri_escape_string (resource_basename, NULL, TRUE); + g_free (resource_basename); + + resource_dest_uri = g_strdup_printf ("%s/%s", destination_uri, resource_name); g_free (resource_name); file = g_file_new_for_uri (resource_dest_uri); -- cgit v1.2.3