From aa5aeaf23c145d18401eeed9d41ae927a37c92e6 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Mon, 7 Nov 2011 23:11:08 +0100 Subject: [PATCH] Don't confuse filename and input in midori_browser_save_uri The file chooser expects UTF-8 as if typed by the user, not a filename in the local encoding. --- midori/midori-browser.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/midori/midori-browser.c b/midori/midori-browser.c index dae48ad9..b89a3505 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -1046,17 +1046,10 @@ midori_browser_save_uri (MidoriBrowser* browser, g_free (filename); } - /* Try to provide a good default filename */ - filename = g_filename_from_uri (uri, NULL, NULL); - if (!filename && (last_slash = g_strrstr (uri, "/"))) - { - if (last_slash[0] == '/') - last_slash++; - filename = g_strdup (last_slash); - } - else - filename = g_strdup (uri); - gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), filename); + /* Try to provide a good default filename, UTF-8 encoded */ + filename = soup_uri_decode (uri); + last_slash = g_strrstr (filename, "/") + 1; + gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), last_slash); g_free (filename); } -- 2.39.5