Skip to content

Commit 6e20357

Browse files
committed
Merge branch 'lt/mailinfo-handle-attachment-more-sanely' into maint
A patch attached as application/octet-stream (e.g. not text/*) were mishandled, not correctly honoring Content-Transfer-Encoding (e.g. base64). * lt/mailinfo-handle-attachment-more-sanely: mailinfo: don't require "text" mime type for attachments
2 parents 9376c86 + 9d55b2e commit 6e20357

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

builtin/mailinfo.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ static struct strbuf email = STRBUF_INIT;
1919
static enum {
2020
TE_DONTCARE, TE_QP, TE_BASE64
2121
} transfer_encoding;
22-
static enum {
23-
TYPE_TEXT, TYPE_OTHER
24-
} message_type;
2522

2623
static struct strbuf charset = STRBUF_INIT;
2724
static int patch_lines;
@@ -184,8 +181,6 @@ static void handle_content_type(struct strbuf *line)
184181
struct strbuf *boundary = xmalloc(sizeof(struct strbuf));
185182
strbuf_init(boundary, line->len);
186183

187-
if (!strcasestr(line->buf, "text/"))
188-
message_type = TYPE_OTHER;
189184
if (slurp_attr(line->buf, "boundary=", boundary)) {
190185
strbuf_insert(boundary, 0, "--", 2);
191186
if (++content_top > &content[MAX_BOUNDARIES]) {
@@ -681,7 +676,6 @@ static int handle_boundary(void)
681676
/* set some defaults */
682677
transfer_encoding = TE_DONTCARE;
683678
strbuf_reset(&charset);
684-
message_type = TYPE_TEXT;
685679

686680
/* slurp in this section's info */
687681
while (read_one_header_line(&line, fin))
@@ -895,11 +889,6 @@ static void handle_body(void)
895889
strbuf_insert(&line, 0, prev.buf, prev.len);
896890
strbuf_reset(&prev);
897891

898-
/* binary data most likely doesn't have newlines */
899-
if (message_type != TYPE_TEXT) {
900-
handle_filter(&line);
901-
break;
902-
}
903892
/*
904893
* This is a decoded line that may contain
905894
* multiple new lines. Pass only one chunk

0 commit comments

Comments
 (0)