From bcfdc265ed89edbef118c0dfd046c91fce175116 Mon Sep 17 00:00:00 2001 From: Sergio Villar Senin Date: Thu, 13 Aug 2009 12:27:21 +0200 Subject: [PATCH] Fixes NB#131375, use the unescaped name of files to check if they already exist --- src/hildon2/modest-msg-view-window.c | 5 ++++- src/modest-utils.h | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) 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 */ -- 1.7.9.5