aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rfc822/message_test.go
Commit message (Collapse)AuthorAgeFilesLines
* rfc822: make header parsing less pedanticRobin Jarry2024-07-151-6/+12
| | | | | | | | | | | | | When receiving invalid headers, just log the errors and move on with our life. When failing to decode addresses, do whatever is possible to at least make the message readable. Changelog-fixed: Aerc is now less pedantic about invalid headers for the maildir and notmuch backends. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Vitaly Ovchinnikov <v@ovch.ru> Tested-by: inwit <inwit@sindominio.net>
* rfc822: be liberal with invalid address headersRobin Jarry2024-07-021-0/+53
| | | | | | | | | | | | | | | | | | | | | | | | Some email clients format email addresses with quotes around B encoded names. E.g.: "=?utf-8?B?U21pZXRhbnNraSwgV29qY2llY2ggVGFkZXVzeiBpbiBUZWFtcw==?=" This seems non standard. I tried reading the multiple RFCs that describe the MIME headers encoding but could not find any precise answer to determine if adding quotes around encoded words is valid or not. In any case, ParseAddressList completely ignores any encoding when it encounters a double quote. When that happens, try to detect it and force decoding a second time after the quotes have been removed. Link: https://datatracker.ietf.org/doc/html/rfc2045#section-3 Link: https://datatracker.ietf.org/doc/html/rfc2047#section-2 Link: https://datatracker.ietf.org/doc/html/rfc822#section-3.3 Reported-by: Bence Ferdinandy <bence@ferdinandy.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* rfc822: modify unit tests for message date parsingVitaly Ovchinnikov2024-01-171-6/+21
| | | | | | | | | | | Modify the message date parser tests so they accept all the possible parsing results, depending on the user's locale settings. Fixes: 49a8cf10935f ("rfc822: improve dates parsing") Reported-by: Jason Cox <me@jasoncarloscox.com> Signed-off-by: Vitaly Ovchinnikov <v@ovch.ru> Tested-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
* rfc822: improve dates parsingVitaly Ovchinnikov2023-12-301-4/+40
| | | | | | | | Provide better parsing of email dates with timezone names, but without numeric offsets. Add unit tests to check the new behaviour. Signed-off-by: Vitaly Ovchinnikov <v@ovch.ru> Acked-by: Robin Jarry <robin@jarry.cc>
* worker: move shared code to libRobin Jarry2023-10-281-0/+84
Avoid importing code from worker/lib into lib. It should only be the other way around. Move the message parsing code used by maildir, notmuch, mbox and the eml viewer into a lib/rfc822 package. Adapt imports accordingly. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Inwit <inwit@sindominio.net>