summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2018-09-02 21:38:34 +0200
committerRicardo Wurmus <rekado@elephly.net>2018-09-02 21:38:34 +0200
commit165119a0477a4bf0f61d5f49586d95ed556e87df (patch)
treeab3098e48d6ba8bc5c361d07eccc8643775ed6e2
parent970f6acf56edcdc9a56ab3ea9d4b324e0c4d9aea (diff)
collect-parts: Allow empty line before boundary.
-rw-r--r--mumi/messages.scm14
1 files changed, 10 insertions, 4 deletions
diff --git a/mumi/messages.scm b/mumi/messages.scm
index 2e0f8ca..f228687 100644
--- a/mumi/messages.scm
+++ b/mumi/messages.scm
@@ -224,10 +224,16 @@ multipart messages."
(let* ((boundary (string-append "--"
(assoc-ref attributes "boundary")))
(final-boundary (string-append boundary "--")))
- (if (string=? boundary line)
- (collect-parts boundary port)
- ;; Invalid multipart message
- '()))))
+ (cond
+ ((or (string=? boundary line)
+ ;; It's possible that the first line is
+ ;; empty and is followed by the boundary.
+ (and (string-null? line)
+ (string=? boundary (get-line port))))
+ (collect-parts boundary port))
+ (else
+ ;; Invalid multipart message
+ '())))))
;; TODO: there might be some white space after the end of
;; this embedded multipart message. Not sure what to do
;; with it, though.