]> git.elephly.net Git - software/mumi.git/commitdiff
collect-parts: Allow empty line before boundary.
authorRicardo Wurmus <rekado@elephly.net>
Sun, 2 Sep 2018 19:38:34 +0000 (21:38 +0200)
committerRicardo Wurmus <rekado@elephly.net>
Sun, 2 Sep 2018 19:38:34 +0000 (21:38 +0200)
mumi/messages.scm

index 2e0f8ca35ccc2ee9b6e5dd2bc0da406d4773c8e5..f2286871eff5c0752fa410b11446c190609b0337 100644 (file)
@@ -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.