-
Notifications
You must be signed in to change notification settings - Fork 109
Open
Description
Describe the bug
InternetAddress.parse does not handle comments within angled address specs.
To Reproduce
(These steps are in Clojure because that's what I have readily available; translating to pure Java should be very intuitive.)
$ clj -Sdeps '{:deps {jakarta.mail/jakarta.mail-api {:mvn/version "2.1.3"}}}'
Clojure 1.12.0
user=> (import 'jakarta.mail.internet.InternetAddress)
jakarta.mail.internet.InternetAddress
user=> (def address "\"John Doe\" <[email protected] (John Doe)>")
#'user/address
user=> (InternetAddress. address)
Execution error (AddressException) at jakarta.mail.internet.InternetAddress/checkAddress (InternetAddress.java:1401).
Domain contains control or whitespace
user=> (.getAddress (first (InternetAddress/parseHeader address false)))
"[email protected] (John Doe)"
user=> Expected behavior
Comment blocks should be ignored when found within angled address specs.
Desktop (please complete the following information):
- OS: Ubuntu 24.04
Additional context
This may fall under the Obsolete Syntax from newer RFCs. However that section does also state:
Though these syntactic forms MUST NOT be generated according to the grammar in section 3, they MUST be accepted and parsed by a conformant receiver.
Metadata
Metadata
Assignees
Labels
No labels