2009-04-20 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
authorkov@webkit.org <kov@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Apr 2009 17:16:20 +0000 (17:16 +0000)
committerkov@webkit.org <kov@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Apr 2009 17:16:20 +0000 (17:16 +0000)
        Reviewed by Xan Lopez.

        https://bugs.webkit.org/show_bug.cgi?id=24786
        WebKitDownload sometimes suggests peculiar filenames

        Remove query and ref from the URI that is to be downloaded when
        using it to provide a file name suggestion.

        * webkit/webkitdownload.cpp:
        (_WebKitDownloadPrivate::webkit_download_set_property):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@42672 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/gtk/ChangeLog
WebKit/gtk/webkit/webkitdownload.cpp

index a4a8ac5..8ad88ad 100644 (file)
@@ -2,6 +2,19 @@
 
         Reviewed by Xan Lopez.
 
+        https://bugs.webkit.org/show_bug.cgi?id=24786
+        WebKitDownload sometimes suggests peculiar filenames
+
+        Remove query and ref from the URI that is to be downloaded when
+        using it to provide a file name suggestion.
+
+        * webkit/webkitdownload.cpp:
+        (_WebKitDownloadPrivate::webkit_download_set_property):
+
+2009-04-20  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
+
+        Reviewed by Xan Lopez.
+
         Handle the case when the plugin view is destroyed during
         didReceiveResponse, to avoid crashing.
 
index b1f61f4..f2e1f9f 100644 (file)
@@ -186,13 +186,17 @@ static void webkit_download_set_property(GObject* object, guint prop_id, const G
 {
     WebKitDownload* download = WEBKIT_DOWNLOAD(object);
     WebKitDownloadPrivate* priv = download->priv;
+    KURL url;
 
     switch(prop_id) {
     case PROP_NETWORK_REQUEST:
         priv->networkRequest = WEBKIT_NETWORK_REQUEST(g_value_dup_object(value));
         // This is safe as network-request is a construct only property and
         // suggestedFilename is initially null.
-        priv->suggestedFilename = g_path_get_basename(webkit_network_request_get_uri(priv->networkRequest));
+        url = KURL(KURL(), webkit_network_request_get_uri(priv->networkRequest));
+        url.setQuery(String());
+        url.removeRef();
+        priv->suggestedFilename = g_strdup(decodeURLEscapeSequences(url.lastPathComponent()).utf8().data());
         break;
     case PROP_DESTINATION_URI:
         webkit_download_set_destination_uri(download, g_value_get_string(value));