msgviewer: bypass filter for headers

This commit is contained in:
Reto Brunner 2020-01-04 20:38:59 +01:00 committed by Drew DeVault
parent 7a1770f129
commit cb168682b3

View file

@ -585,18 +585,21 @@ func (pv *PartViewer) attemptCopy() {
} }
go func() { go func() {
if pv.showHeaders && pv.msg.RFC822Headers != nil { if pv.showHeaders && pv.msg.RFC822Headers != nil {
// header need to bypass the filter, else we run into issues
// with the filter messing with newlines etc.
// 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() {
field := fmt.Sprintf( field := fmt.Sprintf(
"%s: %s\n", fields.Key(), fields.Value()) "%s: %s\n", fields.Key(), fields.Value())
pv.sink.Write([]byte(field)) pv.pagerin.Write([]byte(field))
} }
// virtual header // virtual header
if len(pv.msg.Labels) != 0 { if len(pv.msg.Labels) != 0 {
labels := fmtHeader(pv.msg, "Labels", "") labels := fmtHeader(pv.msg, "Labels", "")
pv.sink.Write([]byte(fmt.Sprintf("Labels: %s\n", labels))) pv.pagerin.Write([]byte(fmt.Sprintf("Labels: %s\n", labels)))
} }
pv.sink.Write([]byte{'\n'}) pv.pagerin.Write([]byte{'\n'})
} }
entity, err := message.New(header, pv.source) entity, err := message.New(header, pv.source)