diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-12-21 17:39:24 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-12-21 17:41:17 +0200 |
commit | bb7a8f74658dd594a3119304c0220cc30e1aac58 (patch) | |
tree | e505f8e61c41564e762de6cf847a756355bc1152 | |
parent | c1df90d8eb9c063768b72c39b41254f9ab7976e9 (diff) | |
download | mailutils-bb7a8f74658dd594a3119304c0220cc30e1aac58.tar.gz mailutils-bb7a8f74658dd594a3119304c0220cc30e1aac58.tar.bz2 |
Fix https://savannah.gnu.org/bugs/index.php?57431
* libmailutils/mime/attachment.c (at_hdr): Always use base file
name without directory components for both filename and name.
(mu_message_create_attachment): Update accordingly.
* NEWS: Update.
-rw-r--r-- | NEWS | 9 | ||||
-rw-r--r-- | libmailutils/mime/attachment.c | 25 |
2 files changed, 16 insertions, 18 deletions
@@ -1,7 +1,7 @@ -GNU mailutils NEWS -- history of user-visible changes. 2019-12-15 +GNU mailutils NEWS -- history of user-visible changes. 2019-12-21 Copyright (C) 2002-2019 Free Software Foundation, Inc. See the end of file for copying conditions. Please send mailutils bug reports to <bug-mailutils@gnu.org>. Version 3.8.90 (git) @@ -71,13 +71,18 @@ The following deprecated functions have been removed: * Remove deprecated ioctls The following ioctl codes have been removed: MU_IOCTL_LOGSTREAM_GET_LOCUS, and MU_IOCTL_LOGSTREAM_SET_LOCUS. -* mail: when sending attachments, make sure message body has inline disposition +* mail: fix composing MIME messages + +- Make sure message body has inline disposition (fixes bug #54992). +- When building the "filename" parameter of the Content-Disposition + header, and the "name" parameter of the Content-Type header, strip + directory components off the original file name (fixes bug #57431). * Fix build on FreeBSD * Fix detection of Kerberos libraries diff --git a/libmailutils/mime/attachment.c b/libmailutils/mime/attachment.c index cf08f0304..c8fc7d1ca 100644 --- a/libmailutils/mime/attachment.c +++ b/libmailutils/mime/attachment.c @@ -58,22 +58,22 @@ static int at_hdr (mu_header_t hdr, const char *content_type, const char *encoding, const char *name, const char *filename) { int rc; char *val, *str; + if (filename) + { + str = strrchr (filename, '/'); + if (str) + filename = str + 1; + } + if (!name) { - if (filename) - { - name = strrchr (filename, '/'); - if (name) - name++; - else - name = filename; - } + name = filename; } if (name) { rc = mu_c_str_escape (name, "\\\"", NULL, &str); if (rc) @@ -217,25 +217,18 @@ mu_attachment_copy_from_file (mu_message_t att, char const *filename) int mu_message_create_attachment (const char *content_type, const char *encoding, const char *filename, mu_message_t *newmsg) { int rc; - char const *name; mu_message_t att; if (content_type == NULL) content_type = "text/plain"; - name = strrchr (filename, '/'); - if (name) - name++; - else - name = filename; - - rc = mu_attachment_create (&att, content_type, encoding, name, filename); + rc = mu_attachment_create (&att, content_type, encoding, NULL, filename); if (rc == 0) { rc = mu_attachment_copy_from_file (att, filename); if (rc) mu_message_destroy (&att, NULL); } |