]> granicus.if.org Git - neomutt/commitdiff
Fix compose and edit attachment symlink failure code
authorKevin McCarthy <kevin@8t8.us>
Sat, 22 Jun 2019 19:35:58 +0000 (12:35 -0700)
committerRichard Russon <rich@flatcap.org>
Mon, 24 Jun 2019 15:20:39 +0000 (16:20 +0100)
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 <rich@flatcap.org>
mutt_attach.c

index c983b084fe21be59fc250e9aacb7606195850c20..66978ac5124f2ef8a5e43a7678a9becb13c10762 100644 (file)
@@ -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;