]> diplodocus.org Git - nmh/commitdiff
Fixed convertarg handling of text part in multipart/related.
authorDavid Levine <levinedl@acm.org>
Tue, 6 Jan 2015 01:10:33 +0000 (19:10 -0600)
committerDavid Levine <levinedl@acm.org>
Tue, 6 Jan 2015 01:10:33 +0000 (19:10 -0600)
test/repl/test-convert
uip/mhbuildsbr.c

index a651957..000f46f 100755 (executable)
@@ -120,4 +120,46 @@ mhbuild "$actual"
 check "$actual" "$expected"
 
 
 check "$actual" "$expected"
 
 
+# check message with text part in multipart/related
+cat >"$expected" <<'EOF'
+From: recipient@example.com
+To: sender@example.com
+cc: 
+Fcc: +outbox
+Subject: Re: test with text part in multipart/related
+Comments: In-reply-to sender@example.com
+   message dated "."
+MIME-Version: 1.0
+Content-Type: text/plain; charset="UTF-8"
+Content-Transfer-Encoding: 8bit
+
+sender@example.com writes:
+
+EOF
+
+cat >`mhpath new` <<'EOF'
+From: sender@example.com
+To: recipient@example.com
+Subject: test with text part in multipart/related
+Content-Type: multipart/alternative; boundary="_001_"
+MIME-Version: 1.0
+
+--_001_
+Content-Type: multipart/related; type="text/plain"; boundary="_002_"
+
+--_002_
+Content-Type: text/plain
+
+
+
+--_002_--
+
+--_001_--
+EOF
+
+repl -filter mhl.replywithoutbody -convertarg text/plain '' -nowhatnowproc last
+mhbuild "$actual"
+check "$actual" "$expected"
+
+
 exit $failed
 exit $failed
index 7984b7d..850ec8f 100644 (file)
@@ -2293,8 +2293,8 @@ expand_pseudoheader (CT ct, CT *text_plain_ct, struct multipart *m,
     /* Concatenate text/plain parts. */
     if (reply_ct->c_type == CT_TEXT  &&
         reply_ct->c_subtype == TEXT_PLAIN) {
     /* Concatenate text/plain parts. */
     if (reply_ct->c_type == CT_TEXT  &&
         reply_ct->c_subtype == TEXT_PLAIN) {
-
-        if (m->mp_parts  &&  ! *text_plain_ct) {
+        if (! *text_plain_ct  &&  m->mp_parts  &&  m->mp_parts->mp_part  &&
+            m->mp_parts->mp_part->c_type == CT_TEXT) {
             *text_plain_ct = m->mp_parts->mp_part;
             /* Make sure that the charset is set in the text/plain
                part. */
             *text_plain_ct = m->mp_parts->mp_part;
             /* Make sure that the charset is set in the text/plain
                part. */