/* 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;
}
{
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);