diff options
author | Reto Brunner <reto@labrat.space> | 2020-05-17 11:44:38 +0200 |
---|---|---|
committer | Reto Brunner <reto@labrat.space> | 2020-05-17 11:44:38 +0200 |
commit | 13a6a3fa7109ce6dcff79ea9ed2a012226386fad (patch) | |
tree | f182c5d8f8dbaf5a6445b5c226a229faa7005efa /commands/msgview/save.go | |
parent | bae678e8f20605b64596c9e976623f2a37247adb (diff) | |
download | aerc-13a6a3fa7109ce6dcff79ea9ed2a012226386fad.tar.gz |
FetchBodyPart doesn't need the parent body structure
Diffstat (limited to 'commands/msgview/save.go')
-rw-r--r-- | commands/msgview/save.go | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/commands/msgview/save.go b/commands/msgview/save.go index f3cbb70a..ef6bba8a 100644 --- a/commands/msgview/save.go +++ b/commands/msgview/save.go @@ -109,21 +109,20 @@ func (Save) Execute(aerc *widgets.Aerc, args []string) error { ch := make(chan error, 1) store := mv.Store() - store.FetchBodyPart( - pi.Msg.Uid, pi.Msg.BodyStructure, pi.Index, func(reader io.Reader) { - f, err := os.Create(path) - if err != nil { - ch <- err - return - } - defer f.Close() - _, err = io.Copy(f, reader) - if err != nil { - ch <- err - return - } - ch <- nil - }) + store.FetchBodyPart(pi.Msg.Uid, pi.Index, func(reader io.Reader) { + f, err := os.Create(path) + if err != nil { + ch <- err + return + } + defer f.Close() + _, err = io.Copy(f, reader) + if err != nil { + ch <- err + return + } + ch <- nil + }) // we need to wait for the callback prior to displaying a result go func() { |