diff options
author | Kevin McCarthy <kevin@8t8.us> | 2020-07-10 13:41:53 -0700 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2020-07-10 14:39:36 -0700 |
commit | c94f43f98afb2cce0df5d6de0b3b0f1a0c79b0d8 (patch) | |
tree | 2b536460e583dc607f87504d27901f11ccd0d1f4 /attach.c | |
parent | b8217c6b21b38f01ebf13bdd6789496debd14ce0 (diff) |
Fix mutt_print_attachment_list() to unstuff format=flowed.
Several of the cases are covered by the pipe fixes in the last commit.
The last case is similar to the mutt_view_attachment case. Since the
send-mode file might be modified, change it to always save to a
tempfile and then unstuff the tempfile.
Diffstat (limited to 'attach.c')
-rw-r--r-- | attach.c | 34 |
1 files changed, 10 insertions, 24 deletions
@@ -961,7 +961,7 @@ int mutt_print_attachment (FILE *fp, BODY *a) if (rfc1524_mailcap_lookup (a, type, sizeof(type), NULL, MUTT_PRINT)) { rfc1524_entry *entry = NULL; - int piped = FALSE; + int piped = 0; dprint (2, (debugfile, "Using mailcap...\n")); @@ -970,24 +970,11 @@ int mutt_print_attachment (FILE *fp, BODY *a) mutt_rfc1524_expand_filename (entry->nametemplate, a->filename, newfile); - /* send mode: symlink from existing file to the newfile */ - if (!fp) - { - if (safe_symlink (a->filename, mutt_b2s (newfile)) == -1) - { - if (mutt_yesorno (_("Can't match nametemplate, continue?"), MUTT_YES) != MUTT_YES) - goto mailcap_cleanup; - mutt_buffer_strcpy (newfile, a->filename); - } - else - unlink_newfile = 1; - } - /* in recv mode, save file to newfile first */ - else - { - if (mutt_save_attachment (fp, a, mutt_b2s (newfile), 0, NULL) == -1) - goto mailcap_cleanup; - } + if (mutt_save_attachment (fp, a, mutt_b2s (newfile), 0, NULL) == -1) + goto mailcap_cleanup; + unlink_newfile = 1; + + mutt_rfc3676_space_unstuff_attachment (a, mutt_b2s (newfile)); mutt_buffer_strcpy (command, entry->printcommand); piped = mutt_rfc1524_expand_command (a, mutt_b2s (newfile), type, command); @@ -1024,10 +1011,8 @@ int mutt_print_attachment (FILE *fp, BODY *a) rc = 1; mailcap_cleanup: - if (fp) + if (unlink_newfile) mutt_unlink (mutt_b2s (newfile)); - else if (unlink_newfile) - unlink(mutt_b2s (newfile)); rfc1524_free_entry (&entry); goto out; @@ -1049,7 +1034,7 @@ int mutt_print_attachment (FILE *fp, BODY *a) mutt_buffer_mktemp (newfile); if (mutt_decode_save_attachment (fp, a, mutt_b2s (newfile), MUTT_PRINTING, 0) == 0) { - + unlink_newfile = 1; dprint (2, (debugfile, "successfully decoded %s type attachment to %s\n", type, mutt_b2s (newfile))); @@ -1082,7 +1067,8 @@ int mutt_print_attachment (FILE *fp, BODY *a) decode_cleanup: safe_fclose (&ifp); safe_fclose (&fpout); - mutt_unlink (mutt_b2s (newfile)); + if (unlink_newfile) + mutt_unlink (mutt_b2s (newfile)); } else { |