[Xfce4-commits] <midori:master> Proper extension fallback for temporary files

Christian Dywan noreply at xfce.org
Sun Sep 9 22:36:05 CEST 2012


Updating branch refs/heads/master
         to 33efb946660d5b51fca214f6c0854c9fde3c3095 (commit)
       from dd90c2b65bc8ef80112df8c79b0e5b69dcc16f61 (commit)

commit 33efb946660d5b51fca214f6c0854c9fde3c3095
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sun Sep 9 21:11:13 2012 +0200

    Proper extension fallback for temporary files

 midori/midori-download.vala |    4 ++--
 midori/midori-view.c        |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/midori/midori-download.vala b/midori/midori-download.vala
index ce9003c..cd294fb 100644
--- a/midori/midori-download.vala
+++ b/midori/midori-download.vala
@@ -223,8 +223,8 @@ namespace Midori {
             /* Try to provide a good default filename, UTF-8 encoded */
             string filename = clean_filename (Soup.URI.decode (uri));
             /* Take the rest of the URI if needed */
-            if (filename.has_suffix ("/"))
-                return filename + fallback_extension (null, mime_type);
+            if (filename.has_suffix ("/") || uri.index_of_char ('.') == -1)
+                return Path.build_filename (filename, fallback_extension (null, mime_type));
             return filename;
         }
 
diff --git a/midori/midori-view.c b/midori/midori-view.c
index 808d34c..22e1637 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -5470,7 +5470,7 @@ midori_view_save_source (MidoriView* view,
     {
         gchar* extension = midori_download_get_extension_for_uri (uri, NULL);
         unique_filename = g_strdup_printf ("%s/%uXXXXXX%s", midori_paths_get_tmp_dir (),
-            g_str_hash (uri), midori_download_fallback_extension (view->mime_type, extension));
+            g_str_hash (uri), midori_download_fallback_extension (extension, view->mime_type));
         g_free (extension);
         katze_mkdir_with_parents (midori_paths_get_tmp_dir (), 0700);
         fd = g_mkstemp (unique_filename);


More information about the Xfce4-commits mailing list