From b15fd4cc51594111c3f452636d96b3e5e543071d Mon Sep 17 00:00:00 2001 From: "Taylor R. Campbell" Date: Mon, 10 Sep 2007 16:21:59 +0000 Subject: [PATCH] Fix bug whereby MIME parser for multipart messages would omit text from parts with no headers starting from the beginning until the first blank line. Do this by changing MIME:PARSE-PARTS to handle the case of properly headerless messages, which begin with an empty line. --- v7/src/imail/imail-mime.scm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/v7/src/imail/imail-mime.scm b/v7/src/imail/imail-mime.scm index cf1e3e34b..5715c78a5 100644 --- a/v7/src/imail/imail-mime.scm +++ b/v7/src/imail/imail-mime.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: imail-mime.scm,v 1.6 2007/08/05 08:26:00 riastradh Exp $ +$Id: imail-mime.scm,v 1.7 2007/09/10 16:21:59 riastradh Exp $ Copyright 2005 Taylor Campbell @@ -389,7 +389,11 @@ USA. (mime:parse-body-structure (let ((start (car part)) (end (cdr part))) - (cond ((substring-search-forward "\n\n" body start end) + (cond ((char=? #\newline (string-ref body start)) + ;; If it starts with a blank line, there are no + ;; headers. + (make-message-part-message '() body (+ start 1) end)) + ((substring-search-forward "\n\n" body start end) => (lambda (header-end) (make-message-part-message (lines->header-fields @@ -401,8 +405,8 @@ USA. (+ header-end 2) end))) (else - ;; Grossly assume that this means there are no - ;; headers. + ;; Grossly assume that the absence of a blank line + ;; means there are no headers. (make-message-part-message '() body start end)))))) parts)) -- 2.25.1