[epiphany] window-commands: fallback correctly when Content-Disposition is not available
- From: Xan Lopez <xan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] window-commands: fallback correctly when Content-Disposition is not available
- Date: Thu, 2 Aug 2012 10:44:58 +0000 (UTC)
commit 18720165e359b9d127fd378214910b544121be7d
Author: Xan Lopez <xan igalia com>
Date: Thu Aug 2 12:36:51 2012 +0200
window-commands: fallback correctly when Content-Disposition is not available
The suggested filename the network response gives us can be
NULL. Fallback to the old method in that case.
src/window-commands.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/window-commands.c b/src/window-commands.c
index 5a4d211..1c02a56 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -279,7 +279,7 @@ window_cmd_file_open (GtkAction *action,
static char *
get_suggested_filename (EphyWebView *view)
{
- char *suggested_filename;
+ char *suggested_filename = NULL;
const char *mimetype;
#ifdef HAVE_WEBKIT2
WebKitURIResponse *response;
@@ -307,8 +307,21 @@ get_suggested_filename (EphyWebView *view)
}
else
{
- WebKitNetworkResponse *response = webkit_web_frame_get_network_response (frame);
+ WebKitNetworkResponse *response;
+
+#ifdef HAVE_WEBKIT2
+ /* TODO: suggested filename */
+#else
+ response = webkit_web_frame_get_network_response (frame);
suggested_filename = g_strdup (webkit_network_response_get_suggested_filename (response));
+#endif
+
+ if (!suggested_filename)
+ {
+ SoupURI *soup_uri = soup_uri_new (webkit_web_resource_get_uri (web_resource));
+ suggested_filename = g_path_get_basename (soup_uri->path);
+ soup_uri_free (soup_uri);
+ }
}
return suggested_filename;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]