Use the basename of the suggested download name

Sometimes the suggested name contains a folder name.
This commit is contained in:
Christian Dywan 2010-05-08 23:42:49 +02:00
parent cd54d23dbe
commit 6442b34b89

View file

@ -1590,6 +1590,8 @@ midori_view_download_requested_cb (GtkWidget* view,
} }
else else
{ {
const gchar* suggested;
gchar* basename;
gchar* filename; gchar* filename;
gchar* uri; gchar* uri;
@ -1597,8 +1599,11 @@ midori_view_download_requested_cb (GtkWidget* view,
folder = g_strdup (g_get_tmp_dir ()); folder = g_strdup (g_get_tmp_dir ());
else else
folder = katze_object_get_string (browser->settings, "download-folder"); folder = katze_object_get_string (browser->settings, "download-folder");
filename = g_build_filename (folder, suggested = webkit_download_get_suggested_filename (download);
webkit_download_get_suggested_filename (download), NULL); /* 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 the filename exists, choose a different name */
if (g_access (filename, F_OK) == 0) if (g_access (filename, F_OK) == 0)
{ {