]> spindle.queued.net Git - midori/commitdiff
Use the basename of the suggested download name
authorChristian Dywan <christian@twotoasts.de>
Sat, 8 May 2010 21:42:49 +0000 (23:42 +0200)
committerChristian Dywan <christian@twotoasts.de>
Sat, 8 May 2010 22:25:22 +0000 (00:25 +0200)
Sometimes the suggested name contains a folder name.

midori/midori-browser.c

index 28936a9d6d5238d8a425ddc820566438db749c9c..9546325565acb005eb78dfe57181f7e0cc54e72d 100644 (file)
@@ -1590,6 +1590,8 @@ midori_view_download_requested_cb (GtkWidget*      view,
         }
         else
         {
+            const gchar* suggested;
+            gchar* basename;
             gchar* filename;
             gchar* uri;
 
@@ -1597,8 +1599,11 @@ midori_view_download_requested_cb (GtkWidget*      view,
                 folder = g_strdup (g_get_tmp_dir ());
             else
                 folder = katze_object_get_string (browser->settings, "download-folder");
-            filename = g_build_filename (folder,
-                webkit_download_get_suggested_filename (download), NULL);
+            suggested = webkit_download_get_suggested_filename (download);
+            /* The suggested name may contain a folder name */
+            basename = g_path_get_basename (suggested);
+            filename = g_build_filename (folder, basename, NULL);
+            g_free (basename);
             /* If the filename exists, choose a different name  */
             if (g_access (filename, F_OK) == 0)
             {