summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2019-01-27 19:57:26 -0700
committerEduardo Chappa <chappa@washington.edu>2019-01-27 19:57:26 -0700
commit395d898e7467fb4c20fce618a3d14c0ec631557b (patch)
tree8af8ffd94ab2bd54bb66e35435366cb1cab6efb2
parent66f85a7c43c53b0a9dc3518d726bb33ede3b035b (diff)
downloadalpine-395d898e7467fb4c20fce618a3d14c0ec631557b.tar.xz
* When saving an attachment, do an extra effort to save the name
of the file, if this is in the Content-Disposition parameter. Based on a report by Holger Trapp.
-rw-r--r--pith/save.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/pith/save.c b/pith/save.c
index 83a1d570..568501e4 100644
--- a/pith/save.c
+++ b/pith/save.c
@@ -1573,7 +1573,7 @@ save_ex_mask_types(char *hdr, long unsigned int *len, gf_io_t pc)
char *s = NULL;
if(!struncmp(hdr, "content-type:", 13))
- s = "Content-Type: Text/Plain; charset=US-ASCII\015\012X-";
+ s = "Content-Type: Text/Plain; charset=UTF-8\015\012X-";
else if(!struncmp(hdr, "content-description:", 20))
s = "Content-Description: Deleted Attachment\015\012X-";
else if(!struncmp(hdr, "content-transfer-encoding:", 26)
@@ -1616,6 +1616,12 @@ save_ex_explain_parts(struct mail_bodystruct *body, int depth, long unsigned int
unsigned long ilen;
char *name = parameter_val(body->parameter, "name");
+ if(!name){
+ if(body->disposition.type &&
+ !strucmp(body->disposition.type, "ATTACHMENT"))
+ name = parameter_val(body->disposition.parameter, "filename");
+ }
+
if(body->type == TYPEMULTIPART) { /* multipart gets special handling */
PART *part = body->nested.part; /* first body part */
@@ -1642,7 +1648,8 @@ save_ex_explain_parts(struct mail_bodystruct *body, int depth, long unsigned int
body_type_names(body->type),
MAILTMPLEN-300, body->subtype ? body->subtype : "Unknown",
name ? " (Name=\"" : "",
- name ? name : "",
+ name ? (char *) rfc1522_decode_to_utf8((unsigned char *)tmp_20k_buf,
+ SIZEOF_20KBUF, name) : "",
name ? "\")" : "");
}
@@ -1665,7 +1672,8 @@ save_ex_explain_parts(struct mail_bodystruct *body, int depth, long unsigned int
body_type_names(body->type),
MAILTMPLEN-300, body->subtype ? body->subtype : "Unknown",
name ? " (Name=\"" : "",
- name ? name : "",
+ name ? (char *) rfc1522_decode_to_utf8((unsigned char *)tmp_20k_buf,
+ SIZEOF_20KBUF, name) : "",
name ? "\")" : "",
comatose((body->encoding == ENCBASE64)
? ((body->size.bytes * 3)/4)