From: Sergio Villar Senin Date: Thu, 13 Aug 2009 10:27:21 +0000 (+0200) Subject: Fixes NB#131375, use the unescaped name of files to check if they already exist X-Git-Tag: 3.0.17-rc33~2 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=bcfdc265ed89edbef118c0dfd046c91fce175116 Fixes NB#131375, use the unescaped name of files to check if they already exist --- diff --git a/src/hildon2/modest-msg-view-window.c b/src/hildon2/modest-msg-view-window.c index dd1003b..3d8626b 100644 --- a/src/hildon2/modest-msg-view-window.c +++ b/src/hildon2/modest-msg-view-window.c @@ -2883,11 +2883,14 @@ save_mime_parts_to_file_with_checks (GtkWindow *parent, for (iter = files; (iter != NULL) && (replaced_files < 2); iter = g_list_next(iter)) { SaveMimePartPair *pair = iter->data; - if (modest_utils_file_exists (pair->filename)) { + gchar *unescaped = g_uri_unescape_string (pair->filename, NULL); + + if (modest_utils_file_exists (unescaped)) { replaced_files++; if (replaced_files == 1) to_replace = iter; } + g_free (unescaped); } if (replaced_files) { gint response; diff --git a/src/modest-utils.h b/src/modest-utils.h index 3e28048..ffc1ae2 100644 --- a/src/modest-utils.h +++ b/src/modest-utils.h @@ -69,7 +69,9 @@ gboolean modest_utils_folder_writable (const gchar *filename); * modest_utils_file_exists: * @filename: a string * - * Checks if @filename exists + * Checks if @filename exists. The filename must NOT use escaped + * characters as this function uses g_access to check if the file + * exists or not * * Returns: %TRUE if @filename currently exists, %FALSE otherwise */