elixir-mail icon indicating copy to clipboard operation
elixir-mail copied to clipboard

Handle unexpected encoded value

Open darksheik opened this issue 2 years ago • 1 comments

Changes proposed in this pull request

A header in one of the emails which contains a URL is breaking a specific function.

Error message:

** (MatchError) no match of right hand side value: ["signature=374a478e0350ddefa92d80b63f8763c85b289539eee166b47ceca61bfd3397ec"]
    (mail 0.2.3) lib/mail/parsers/rfc_2822.ex:261: Mail.Parsers.RFC2822.parse_encoded_word/1
    (mail 0.2.3) lib/mail/parsers/rfc_2822.ex:277: Mail.Parsers.RFC2822.parse_encoded_word/1
    (mail 0.2.3) lib/mail/parsers/rfc_2822.ex:199: Mail.Parsers.RFC2822.parse_headers/2
    (mail 0.2.3) lib/mail/parsers/rfc_2822.ex:21: Mail.Parsers.RFC2822.parse/1

The header in question is a URL like this, which isn't matching the expected return value of the String.split in that function:

List-Unsubscribe: https://some-domain.com/te/c/abcdef=?signature=abcdef

Would just like to have this parser ignore URL values.

darksheik avatar Apr 15 '22 15:04 darksheik

"=" in the URL outside of the query string is not a valid URL, it should be %3D @darksheik your first attempt in b6b7317 was on the right track rather than explicitly trying to handle “http…” I have put together a more generic fix that handles the "=?" that is not part of a quoted-printable string.

andrewtimberlake avatar Apr 20 '22 06:04 andrewtimberlake

Closed by #142

bcardarella avatar Feb 04 '24 13:02 bcardarella