summaryrefslogtreecommitdiffstats
path: root/hook.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2020-11-06 13:18:27 -0800
committerKevin McCarthy <kevin@8t8.us>2020-11-06 13:18:27 -0800
commit6704caf444fa9746bc641da2ee3f5477d372e50f (patch)
tree90f65635e024ff43c4f7bc91abba152a78cea48c /hook.c
parent533c38f4d725a211fac50eac2f22366f126dfd3e (diff)
Don't relative-path expand for fcc-hook and save-hook.
"fcc-hook ~x. \\^" used to work, because mutt_addr_hook() calls mutt_make_string(), which performs backslash expansion. The same would happen for save-hook. Many thanks to Oswald Buddenhagen for reporting the issue.
Diffstat (limited to 'hook.c')
-rw-r--r--hook.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/hook.c b/hook.c
index 57a0e3af..e5d551fa 100644
--- a/hook.c
+++ b/hook.c
@@ -150,13 +150,27 @@ int mutt_parse_hook (BUFFER *buf, BUFFER *s, union pointer_long_t udata, BUFFER
mutt_check_simple (pattern, DefaultHook);
}
- if (data & (MUTT_MBOXHOOK | MUTT_SAVEHOOK))
+ if (data & MUTT_MBOXHOOK)
{
mutt_buffer_expand_path (command);
}
+ else if (data & MUTT_SAVEHOOK)
+ {
+ /* Do not perform relative path expansion. "\^" can be expanded later:
+ * mutt_default_save() => mutt_addr_hook() => mutt_make_string()
+ * which will perform backslash expansion, converting "\^" to "^".
+ * The saving code then calls mutt_buffer_expand_path() after prompting.
+ */
+ mutt_buffer_expand_path_norel (command);
+ }
else if (data & MUTT_FCCHOOK)
{
- mutt_buffer_expand_multi_path (command, FccDelimiter);
+ /* Do not perform relative path expansion "\^" can be expanded later:
+ * mutt_select_fcc() => mutt_addr_hook() => mutt_make_string()
+ * which will perform backslash expansion, converting "\^" to "^".
+ * save_fcc_mailbox_part() then calls mutt_buffer_expand_path() on each part.
+ */
+ mutt_buffer_expand_multi_path_norel (command, FccDelimiter);
}
/* check to make sure that a matching hook doesn't already exist */