forward: remove crlf in text body

Remove crlf from the text body when forwarding a message.

Signed-off-by: Koni Marti <koni.marti@gmail.com>
Tested-by: Tim Culverhouse <tim@timculverhouse.com>
This commit is contained in:
Koni Marti 2022-06-28 23:42:09 +02:00 committed by Robin Jarry
parent 60052c6070
commit c04446327e

View file

@ -1,6 +1,7 @@
package msg package msg
import ( import (
"bufio"
"bytes" "bytes"
"errors" "errors"
"fmt" "fmt"
@ -164,7 +165,10 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error {
} }
store.FetchBodyPart(msg.Uid, part, func(reader io.Reader) { store.FetchBodyPart(msg.Uid, part, func(reader io.Reader) {
buf := new(bytes.Buffer) buf := new(bytes.Buffer)
buf.ReadFrom(reader) scanner := bufio.NewScanner(reader)
for scanner.Scan() {
buf.WriteString(scanner.Text() + "\n")
}
original.Text = buf.String() original.Text = buf.String()
// create composer // create composer