aboutsummaryrefslogtreecommitdiffstats
path: root/commands/msgview/save.go
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2022-06-23 11:26:19 -0500
committerRobin Jarry <robin@jarry.cc>2022-06-24 21:08:21 +0200
commit8f9bb2b289af34581b43e0777b2376ab0617aecd (patch)
treead89fdf43896e34fec883d16bcae7bd61a8f1049 /commands/msgview/save.go
parente9b01867827aac29f11b376debaf2209e8e7c9b4 (diff)
downloadaerc-8f9bb2b289af34581b43e0777b2376ab0617aecd.tar.gz
pgp: fix pipe|open|save command behavior
Signed and/or encrypted PGP messages did not behave properly for pipe, open, and save commands. Specifically, the proper Message Part would not be passed to the command in the MessageViewer. This is due to the encapsulation of the body structure. This patch fixes the behavior for piping|opening|saving of message parts. Fixes: https://todo.sr.ht/~rjarry/aerc/47 Reported-by: ~ph14nix Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'commands/msgview/save.go')
-rw-r--r--commands/msgview/save.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/commands/msgview/save.go b/commands/msgview/save.go
index 2a5eadf9..8aedd428 100644
--- a/commands/msgview/save.go
+++ b/commands/msgview/save.go
@@ -13,7 +13,6 @@ import (
"github.com/mitchellh/go-homedir"
"git.sr.ht/~rjarry/aerc/commands"
- "git.sr.ht/~rjarry/aerc/lib"
"git.sr.ht/~rjarry/aerc/logging"
"git.sr.ht/~rjarry/aerc/models"
"git.sr.ht/~rjarry/aerc/widgets"
@@ -105,8 +104,6 @@ func (Save) Execute(aerc *widgets.Aerc, args []string) error {
return fmt.Errorf("SelectedTab is not a MessageViewer")
}
- store := mv.Store()
-
if params.attachments {
parts := mv.AttachmentParts()
if len(parts) == 0 {
@@ -114,7 +111,7 @@ func (Save) Execute(aerc *widgets.Aerc, args []string) error {
}
params.trailingSlash = true
for _, pi := range parts {
- if err := savePart(pi, path, store, aerc, &params); err != nil {
+ if err := savePart(pi, path, mv, aerc, &params); err != nil {
return err
}
}
@@ -122,13 +119,13 @@ func (Save) Execute(aerc *widgets.Aerc, args []string) error {
}
pi := mv.SelectedMessagePart()
- return savePart(pi, path, store, aerc, &params)
+ return savePart(pi, path, mv, aerc, &params)
}
func savePart(
pi *widgets.PartInfo,
path string,
- store *lib.MessageStore,
+ mv *widgets.MessageViewer,
aerc *widgets.Aerc,
params *saveParams,
) error {
@@ -151,7 +148,7 @@ func savePart(
}
ch := make(chan error, 1)
- store.FetchBodyPart(pi.Msg.Uid, pi.Index, func(reader io.Reader) {
+ mv.MessageView().FetchBodyPart(pi.Index, func(reader io.Reader) {
f, err := os.Create(path)
if err != nil {
ch <- err