go-imap icon indicating copy to clipboard operation
go-imap copied to clipboard

backendutil: fix header parsing in FetchEnvelope

Open cnt0 opened this issue 6 years ago • 3 comments

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?

cnt0 avatar Jun 17 '19 14:06 cnt0

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]>"))

foxcpp avatar Jun 17 '19 14:06 foxcpp

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).

emersion avatar Jun 17 '19 14:06 emersion

Codecov Report

Merging #280 into master will increase coverage by <.01%. The diff coverage is 100%.

Impacted file tree graph

@@           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 data Powered by Codecov. Last update 853d87d...a4a75df. Read the comment docs.

codecov[bot] avatar Jun 17 '19 15:06 codecov[bot]

Closing because this is superseded by go-imap v2.

emersion avatar Apr 04 '23 14:04 emersion