diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-04-11 21:40:54 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-04-11 21:44:11 +0800 |
commit | e3295b4d11bca23980472f1d54f4a52927c41539 (patch) | |
tree | 04eb8739cba4f45eaee2ccb0b7174b9d8f1d62fd | |
parent | af7cd52edaf71ae5e4b476389220bfb113ea2c38 (diff) | |
download | gsoc2013-evolution-e3295b4d11bca23980472f1d54f4a52927c41539.tar.gz gsoc2013-evolution-e3295b4d11bca23980472f1d54f4a52927c41539.tar.zst gsoc2013-evolution-e3295b4d11bca23980472f1d54f4a52927c41539.zip |
Bug 673895 - "Send To..." doesn't work anymore
Our hidden file/directory blacklist went a little too far. Evolution
was blacklisting its own temporary files. This changes the blacklist
function to trust the user's own XDG Base Directories.
-rw-r--r-- | composer/e-msg-composer.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 39edcdba43..5c91037fa6 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -3928,12 +3928,23 @@ merge_always_cc_and_bcc (EComposerHeaderTable *table, static const gchar *blacklist[] = { ".", "etc", ".." }; static gboolean -file_is_blacklisted (gchar *filename) +file_is_blacklisted (const gchar *argument) { + GFile *file; gboolean blacklisted = FALSE; guint ii, jj, n_parts; + gchar *filename; gchar **parts; + /* The "attach" argument may be a URI or local path. Normalize + * it to a local path if we can. We only blacklist local files. */ + file = g_file_new_for_commandline_arg (argument); + filename = g_file_get_path (file); + g_object_unref (file); + + if (filename == NULL) + return FALSE; + parts = g_strsplit (filename, G_DIR_SEPARATOR_S, -1); n_parts = g_strv_length (parts); @@ -3946,7 +3957,18 @@ file_is_blacklisted (gchar *filename) } } + if (blacklisted) { + /* Don't blacklist files in trusted base directories. */ + if (g_str_has_prefix (filename, g_get_user_data_dir ())) + blacklisted = FALSE; + if (g_str_has_prefix (filename, g_get_user_cache_dir ())) + blacklisted = FALSE; + if (g_str_has_prefix (filename, g_get_user_config_dir ())) + blacklisted = FALSE; + } + g_strfreev (parts); + g_free (filename); return blacklisted; } |