if (get_field_text(field + plen, &test_command, type, filename, line) && test_command)
{
struct Buffer *command = mutt_buffer_pool_get();
+ struct Buffer *afilename = mutt_buffer_pool_get();
mutt_buffer_strcpy(command, test_command);
- mutt_rfc1524_expand_command(a, a->filename, type, command);
+ if (C_MailcapSanitize)
+ mutt_buffer_sanitize_filename(afilename, NONULL(a->filename), true);
+ else
+ mutt_buffer_strcpy(afilename, NONULL(a->filename));
+ mutt_rfc1524_expand_command(a, mutt_b2s(afilename), type, command);
if (mutt_system(mutt_b2s(command)))
{
/* a non-zero exit code means test failed */
}
FREE(&test_command);
mutt_buffer_pool_release(&command);
+ mutt_buffer_pool_release(&afilename);
}
}
else if (mutt_str_startswith(field, "x-neomutt-keep", CASE_IGNORE))