From: Christian Dywan Date: Sat, 8 May 2010 21:42:49 +0000 (+0200) Subject: Use the basename of the suggested download name X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6442b34b8946f49a26184215abe8c2fb96f2879f;p=midori Use the basename of the suggested download name Sometimes the suggested name contains a folder name. --- diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 28936a9d..95463255 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -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) {