From: Taylor R. Campbell Date: Mon, 10 Sep 2007 16:21:59 +0000 (+0000) Subject: Fix bug whereby MIME parser for multipart messages would omit text X-Git-Tag: 20090517-FFI~448 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=b15fd4cc51594111c3f452636d96b3e5e543071d;p=mit-scheme.git 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. --- 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))