• Michael Stapelberg's avatar
    net/mail: treat comment in address as display name · fcee1897
    Michael Stapelberg authored
    I verified this change on a corpus of > 200 GB of emails since the mid-90s. With
    this change, more addresses parse than before, and anything which parsed before
    still parses.
    
    In said corpus, I came across the edge case of comments preceding an
    addr-spec (with angle brackets!), e.g. “(John Doe) <john@example.com>”, which
    does not satisfy the conditions to be treated as a fallback, as per my reading
    of RFC2822.
    
    This change does not parse quoted-strings within comments (a corresponding TODO
    is in the code), but I have not seen that in the wild.
    
    Fixes #22670
    
    Change-Id: I526fcf7c6390aa1c219fdec1852f26c514506f76
    Reviewed-on: https://go-review.googlesource.com/77474Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    fcee1897
message_test.go 20.6 KB