about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--email/email.scm6
-rw-r--r--tests/email.scm6
2 files changed, 8 insertions, 4 deletions
diff --git a/email/email.scm b/email/email.scm
index a29a532..ff0f5e9 100644
--- a/email/email.scm
+++ b/email/email.scm
@@ -1,5 +1,5 @@
 ;;; guile-email --- Guile email parser
-;;; Copyright © 2018, 2019, 2020, 2021, 2023 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2018, 2019, 2020, 2021, 2023, 2025 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2021 Mathieu Othacehe <othacehe@gnu.org>
 ;;; Copyright © 2023 Andrew Whatson <whatson@tailcall.au>
 ;;;
@@ -360,9 +360,9 @@
 ;; MUAs tend to pass on these non-standard names without any
 ;; quoting. Tolerate such names.
 
-;; Tolerate non-standard ( and ) in atext.
+;; Tolerate non-standard (, ), [ and ] in atext.
 (define-peg-pattern liberal-atext body
-  (or atext "(" ")"))
+  (or atext "(" ")" "[" "]"))
 
 (define-atom-pattern liberal-cfws-captured-atom cfws liberal-atext)
 (define-word-pattern liberal-cfws-captured-word liberal-cfws-captured-atom)
diff --git a/tests/email.scm b/tests/email.scm
index dd305b6..972233d 100644
--- a/tests/email.scm
+++ b/tests/email.scm
@@ -1,6 +1,6 @@
 ;;; guile-email --- Guile email parser
 ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
-;;; Copyright © 2018, 2019, 2020, 2021, 2023 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2018, 2019, 2020, 2021, 2023, 2025 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2023 Andrew Whatson <whatson@tailcall.au>
 ;;;
 ;;; This file was adapted from guile-debbugs and is part of guile-email.
@@ -594,6 +594,10 @@ Content-Type: text/plain; charset=utf-8
   (parse-email-address "Foo(Bar <foo@example.com>")
   '((name . "Foo(Bar") (address . "foo@example.com")))
 
+(test-equal "tolerate email addresses with square brackets in name"
+  (parse-email-address "Foo [Bar] <foo@example.com>")
+  '((name . "Foo [Bar]") (address . "foo@example.com")))
+
 
 ;;;
 ;;; MIME encoded words