[epiphany] Escape the name of resources before saving them
- From: Diego Escalante Urrelo <diegoe src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [epiphany] Escape the name of resources before saving them
- Date: Thu, 21 Jan 2010 14:18:33 +0000 (UTC)
commit 5120ad94e7003841a03189d334576bfe45406408
Author: Diego Escalante Urrelo <descalante igalia com>
Date: Wed Jan 13 11:54:43 2010 -0500
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 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 7a0f921..6294135 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]