From 8f9bb2b289af34581b43e0777b2376ab0617aecd Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Thu, 23 Jun 2022 11:26:19 -0500 Subject: 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 Tested-by: Moritz Poldrack Acked-by: Robin Jarry --- commands/msg/pipe.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'commands/msg') diff --git a/commands/msg/pipe.go b/commands/msg/pipe.go index b33254d7..b354341c 100644 --- a/commands/msg/pipe.go +++ b/commands/msg/pipe.go @@ -182,12 +182,15 @@ func (Pipe) Execute(aerc *widgets.Aerc, args []string) error { } }() } else if pipePart { + mv, ok := provider.(*widgets.MessageViewer) + if !ok { + return fmt.Errorf("can only pipe message part from a message view") + } p := provider.SelectedMessagePart() if p == nil { return fmt.Errorf("could not fetch message part") } - store := provider.Store() - store.FetchBodyPart(p.Msg.Uid, p.Index, func(reader io.Reader) { + mv.MessageView().FetchBodyPart(p.Index, func(reader io.Reader) { if background { doExec(reader) } else { -- cgit