summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2019-12-21 17:39:24 +0200
committerSergey Poznyakoff <gray@gnu.org>2019-12-21 17:41:17 +0200
commitbb7a8f74658dd594a3119304c0220cc30e1aac58 (patch)
treee505f8e61c41564e762de6cf847a756355bc1152
parentc1df90d8eb9c063768b72c39b41254f9ab7976e9 (diff)
downloadmailutils-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--NEWS9
-rw-r--r--libmailutils/mime/attachment.c25
2 files changed, 16 insertions, 18 deletions
diff --git a/NEWS b/NEWS
index d3fbf1b70..761564402 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-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.
@@ -74,7 +74,12 @@ The following deprecated functions have been removed:
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
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
@@ -61,16 +61,16 @@ at_hdr (mu_header_t hdr, const char *content_type, const char *encoding,
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)
@@ -220,19 +220,12 @@ 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);

Return to:

Send suggestions and report system problems to the System administrator.