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;
* 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
*/