aboutsummaryrefslogtreecommitdiffstats
path: root/embed/ephy-web-view.c
diff options
context:
space:
mode:
authorDiego Escalante Urrelo <descalante@igalia.com>2010-01-14 00:54:43 +0800
committerDiego Escalante Urrelo <diegoe@gnome.org>2010-01-21 22:11:57 +0800
commit5120ad94e7003841a03189d334576bfe45406408 (patch)
tree5a4d0b1958f51e3881322d7981e395ab8f7fbc24 /embed/ephy-web-view.c
parent2b5566e52f1dc497cfcecc7639a92b7691b8c3d8 (diff)
downloadgsoc2013-epiphany-5120ad94e7003841a03189d334576bfe45406408.tar
gsoc2013-epiphany-5120ad94e7003841a03189d334576bfe45406408.tar.gz
gsoc2013-epiphany-5120ad94e7003841a03189d334576bfe45406408.tar.bz2
gsoc2013-epiphany-5120ad94e7003841a03189d334576bfe45406408.tar.lz
gsoc2013-epiphany-5120ad94e7003841a03189d334576bfe45406408.tar.xz
gsoc2013-epiphany-5120ad94e7003841a03189d334576bfe45406408.tar.zst
gsoc2013-epiphany-5120ad94e7003841a03189d334576bfe45406408.zip
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
Diffstat (limited to 'embed/ephy-web-view.c')
-rw-r--r--embed/ephy-web-view.c10
1 files 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);