summaryrefslogtreecommitdiff
path: root/widgets
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-05-25 11:56:56 -0400
committerDrew DeVault <sir@cmpwn.com>2019-05-25 11:56:56 -0400
commitcef784bf520470315e93835e9c2828d69de0d5c9 (patch)
tree1fd81d5ddcd630b4d2da5e733a85f864cc2bd0b1 /widgets
parentc4c8648cc716d40f5f6558b5f2bf375d8f9a36d9 (diff)
downloadaerc-cef784bf520470315e93835e9c2828d69de0d5c9.zip
Fix special characters in address.PersonalName
Diffstat (limited to 'widgets')
-rw-r--r--widgets/compose.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/widgets/compose.go b/widgets/compose.go
index 96ee7e7..9de7f97 100644
--- a/widgets/compose.go
+++ b/widgets/compose.go
@@ -12,6 +12,7 @@ import (
"github.com/emersion/go-message/mail"
"github.com/gdamore/tcell"
"github.com/mattn/go-runewidth"
+ "github.com/pkg/errors"
"git.sr.ht/~sircmpwn/aerc/config"
"git.sr.ht/~sircmpwn/aerc/lib"
@@ -232,11 +233,11 @@ func (c *Composer) PrepareHeader() (*mail.Header, []string, error) {
// your types aren't compatible enough with each other
to_rcpts, err := gomail.ParseAddressList(to)
if err != nil {
- return nil, nil, err
+ return nil, nil, errors.Wrapf(err, "ParseAddressList(%s)", to)
}
ed_rcpts, err := header.AddressList("To")
if err != nil {
- return nil, nil, err
+ return nil, nil, errors.Wrap(err, "AddressList(To)")
}
for _, addr := range to_rcpts {
ed_rcpts = append(ed_rcpts, (*mail.Address)(addr))
@@ -266,7 +267,7 @@ func (c *Composer) WriteMessage(header *mail.Header, writer io.Writer) error {
// into the editor? If so this needs to change
part, err := reader.NextPart()
if err != nil {
- return err
+ return errors.Wrap(err, "reader.NextPart")
}
body = part.Body
defer reader.Close()
@@ -277,11 +278,13 @@ func (c *Composer) WriteMessage(header *mail.Header, writer io.Writer) error {
// TODO: attachments
w, err := mail.CreateSingleInlineWriter(writer, *header)
if err != nil {
- return err
+ return errors.Wrap(err, "CreateSingleInlineWriter")
}
defer w.Close()
- _, err = io.Copy(w, body)
- return err
+ if _, err := io.Copy(w, body); err != nil {
+ return errors.Wrap(err, "io.Copy")
+ }
+ return nil
}
func (c *Composer) termClosed(err error) {