]> spindle.queued.net Git - midori/commitdiff
Don't confuse filename and input in midori_browser_save_uri
authorChristian Dywan <christian@twotoasts.de>
Mon, 7 Nov 2011 22:11:08 +0000 (23:11 +0100)
committerChristian Dywan <christian@twotoasts.de>
Mon, 7 Nov 2011 23:28:07 +0000 (00:28 +0100)
The file chooser expects UTF-8 as if typed by the user, not
a filename in the local encoding.

midori/midori-browser.c

index dae48ad9e1688b6cf269a7a6ffdb7d020d760a45..b89a35055c417061ffe51f38280bfd22903e01e0 100644 (file)
@@ -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);
     }