Fixes NB#131375, use the unescaped name of files to check if they already exist
authorSergio Villar Senin <svillar@igalia.com>
Thu, 13 Aug 2009 10:27:21 +0000 (12:27 +0200)
committerSergio Villar Senin <svillar@igalia.com>
Thu, 13 Aug 2009 10:49:54 +0000 (12:49 +0200)
src/hildon2/modest-msg-view-window.c
src/modest-utils.h

index dd1003b..3d8626b 100644 (file)
@@ -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;
index 3e28048..ffc1ae2 100644 (file)
@@ -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
  */