backendutil: fix header parsing in FetchEnvelope
this PR fixes #279 by modifying headerAddressList. Just decode the value before feeding it to ParseAddressList.
Maybe we should decode all other fields like Subject too?
Should ENVELOPE contain decode fields tho?
RFC 3501 is not very clear about it and just refers to "RFC-2822 parsed header". Relevant: #256.
Dovecot returns encoded fields (here is the response for a message with non-ASCII text in Subject):
* 2 FETCH (ENVELOPE ("Tue, 11 Jun 2019 17:54:30 +0000" {77}
=?utf-8?B?VVRGLTgg0LIg0L/QvtC70LUg0LfQsNCz0L7Qu9C+0LLQug==?= =?utf-8?B?0LA=?= (("Max Mazurov" NIL "fox.cpp" "disroot.org")) (("Max Mazurov" NIL "fox.cpp" "disroot.org")) (("Max Mazurov" NIL "fox.cpp" "disroot.org")) ((NIL NIL "foxcpp" "foxcpp.dev")) NIL NIL NIL "<[email protected]>"))
Oh right that's a good point. If we don't want to decode them we probably shouldn't use net/mail here (or find a way to completely disable the quoted-printable parser).
Codecov Report
Merging #280 into master will increase coverage by
<.01%. The diff coverage is100%.
@@ Coverage Diff @@
## master #280 +/- ##
========================================
+ Coverage 72.99% 73% +<.01%
========================================
Files 32 32
Lines 3462 3463 +1
========================================
+ Hits 2527 2528 +1
Misses 642 642
Partials 293 293
| Impacted Files | Coverage Δ | |
|---|---|---|
| backend/backendutil/envelope.go | 94.11% <100%> (+0.17%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 853d87d...a4a75df. Read the comment docs.
Closing because this is superseded by go-imap v2.