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:45:27 +0800 |
commit | 56592175f6898a48eb840ddcfb0dcc9ad4c98038 (patch) | |
tree | 66d9982bb164b98331529a72781b5ce86d1025bd | |
parent | e0fe6450531e08293da52e1ad1a35a974ceeec6c (diff) | |
download | gsoc2013-evolution-56592175f6898a48eb840ddcfb0dcc9ad4c98038.tar gsoc2013-evolution-56592175f6898a48eb840ddcfb0dcc9ad4c98038.tar.gz gsoc2013-evolution-56592175f6898a48eb840ddcfb0dcc9ad4c98038.tar.bz2 gsoc2013-evolution-56592175f6898a48eb840ddcfb0dcc9ad4c98038.tar.lz gsoc2013-evolution-56592175f6898a48eb840ddcfb0dcc9ad4c98038.tar.xz gsoc2013-evolution-56592175f6898a48eb840ddcfb0dcc9ad4c98038.tar.zst gsoc2013-evolution-56592175f6898a48eb840ddcfb0dcc9ad4c98038.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.
(cherry picked from commit e3295b4d11bca23980472f1d54f4a52927c41539)
-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 8da99128e1..1ce578a19c 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -3910,12 +3910,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); @@ -3928,7 +3939,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; } |