diff options
author | Kevin McCarthy <kevin@8t8.us> | 2020-11-06 13:18:27 -0800 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2020-11-06 13:18:27 -0800 |
commit | 6704caf444fa9746bc641da2ee3f5477d372e50f (patch) | |
tree | 90f65635e024ff43c4f7bc91abba152a78cea48c | |
parent | 533c38f4d725a211fac50eac2f22366f126dfd3e (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.
-rw-r--r-- | hook.c | 18 | ||||
-rw-r--r-- | muttlib.c | 5 | ||||
-rw-r--r-- | protos.h | 1 |
3 files changed, 22 insertions, 2 deletions
@@ -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 */ @@ -543,6 +543,11 @@ void mutt_buffer_expand_multi_path (BUFFER *src, const char *delimiter) delimited_buffer_map_join (src, delimiter, mutt_buffer_expand_path); } +void mutt_buffer_expand_multi_path_norel (BUFFER *src, const char *delimiter) +{ + delimited_buffer_map_join (src, delimiter, mutt_buffer_expand_path_norel); +} + void mutt_buffer_expand_path (BUFFER *src) { _mutt_buffer_expand_path (src, 0, 1); @@ -144,6 +144,7 @@ void mutt_buffer_expand_path (BUFFER *); void mutt_buffer_expand_path_norel (BUFFER *); void _mutt_buffer_expand_path (BUFFER *, int, int); void mutt_buffer_expand_multi_path (BUFFER *src, const char *delimiter); +void mutt_buffer_expand_multi_path_norel (BUFFER *src, const char *delimiter); char *mutt_find_hook (int, const char *); char *mutt_gecos_name (char *, size_t, struct passwd *); char *mutt_gen_msgid (void); |