msgviewer: decode headers prior to displaying them

This commit is contained in:
Reto Brunner 2020-01-04 20:39:00 +01:00 committed by Drew DeVault
parent cb168682b3
commit 126119c0b1
1 changed files with 7 additions and 1 deletions

View File

@ -590,8 +590,14 @@ func (pv *PartViewer) attemptCopy() {
// hence all writes in this block go directly to the pager // hence all writes in this block go directly to the pager
fields := pv.msg.RFC822Headers.Fields() fields := pv.msg.RFC822Headers.Fields()
for fields.Next() { for fields.Next() {
var value string
var err error
if value, err = fields.Text(); err != nil {
// better than nothing, use the non decoded version
value = fields.Value()
}
field := fmt.Sprintf( field := fmt.Sprintf(
"%s: %s\n", fields.Key(), fields.Value()) "%s: %s\n", fields.Key(), value)
pv.pagerin.Write([]byte(field)) pv.pagerin.Write([]byte(field))
} }
// virtual header // virtual header