summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--email/email.scm3
-rw-r--r--tests/email.scm9
2 files changed, 12 insertions, 0 deletions
diff --git a/email/email.scm b/email/email.scm
index fdd8031..9478477 100644
--- a/email/email.scm
+++ b/email/email.scm
@@ -723,6 +723,9 @@ values. The returned headers is a string and body is a bytevector."
(cons field value))
((field . values)
(cons field values))
+ ;; If the Subject header is blank, treat it as having the
+ ;; null string as value.
+ ('subject '(subject . ""))
(_ #f))
fields))
diff --git a/tests/email.scm b/tests/email.scm
index 03c3b70..477ddc9 100644
--- a/tests/email.scm
+++ b/tests/email.scm
@@ -376,6 +376,15 @@ copyright =A9")
(charset . "utf-8"))
(content-transfer-encoding . 7bit)))
+(test-alist= "blank Subject header must be treated as having the null string as value"
+ (parse-email-headers
+ "Subject:
+")
+ '((subject . "")
+ (content-type (type . text)
+ (subtype . plain)
+ (charset . "utf-8"))
+ (content-transfer-encoding . 7bit)))
(test-equal "parse name-addr email address"
(parse-email-address "Foo <foo@example.org>")
'((name . "Foo") (address . "foo@example.org")))