From 5d53e2d876c0a2aeb9336b463146825697761659 Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Sat, 22 Jun 2019 12:35:58 -0700 Subject: [PATCH] Fix compose and edit attachment symlink failure code In the case where safe_symlink() fail, mutt prompts to continue, but did not properly reset the filename to be operated on. Fix up mutt_view_attachment() to use the same flow as the others, to allow for easier comparison. Co-authored-by: Richard Russon --- mutt_attach.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mutt_attach.c b/mutt_attach.c index c983b084f..66978ac51 100644 --- a/mutt_attach.c +++ b/mutt_attach.c @@ -141,6 +141,7 @@ int mutt_compose_attachment(struct Body *a) { if (mutt_yesorno(_("Can't match 'nametemplate', continue?"), MUTT_YES) != MUTT_YES) goto bailout; + mutt_buffer_strcpy(newfile, a->filename); } else unlink_newfile = true; @@ -278,6 +279,7 @@ int mutt_edit_attachment(struct Body *a) { if (mutt_yesorno(_("Can't match 'nametemplate', continue?"), MUTT_YES) != MUTT_YES) goto bailout; + mutt_buffer_strcpy(newfile, a->filename); } else unlink_newfile = true; @@ -461,10 +463,9 @@ int mutt_view_attachment(FILE *fp, struct Body *a, enum ViewAttachMode mode, /* send case: the file is already there */ if (mutt_file_symlink(a->filename, mutt_b2s(tmpfile)) == -1) { - if (mutt_yesorno(_("Can't match 'nametemplate', continue?"), MUTT_YES) == MUTT_YES) - mutt_buffer_strcpy(tmpfile, a->filename); - else + if (mutt_yesorno(_("Can't match nametemplate, continue?"), MUTT_YES) != MUTT_YES) goto return_error; + mutt_buffer_strcpy(tmpfile, a->filename); } else unlink_tempfile = true; -- 2.49.0