From 96db50c4f06bab4ef052b584943d8c7113766a06 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Sat, 25 Jun 2022 07:40:10 -0500 Subject: open: fix mimetype discovery for encrypted or signed messages Mimetype discovery for the :open command is based on the BodyStructure of the message. This patch fixes the method which got the BodyStructure of the message to a more generalized one, which is set post-encryption and post-validation. This allows encrypted or signed message parts to have their proper mimetype discovered. Fixes: https://todo.sr.ht/~rjarry/aerc/50 Reported-by: ~ph14nix Signed-off-by: Tim Culverhouse Acked-by: Koni Marti --- commands/msgview/open.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'commands/msgview/open.go') diff --git a/commands/msgview/open.go b/commands/msgview/open.go index c2761729..7615e9a8 100644 --- a/commands/msgview/open.go +++ b/commands/msgview/open.go @@ -52,7 +52,7 @@ func (Open) Execute(aerc *widgets.Aerc, args []string) error { mv.MessageView().FetchBodyPart(p.Index, func(reader io.Reader) { extension := "" // try to determine the correct extension based on mimetype - if part, err := p.Msg.BodyStructure.PartAtIndex(p.Index); err == nil { + if part, err := mv.MessageView().BodyStructure().PartAtIndex(p.Index); err == nil { mimeType := fmt.Sprintf("%s/%s", part.MIMEType, part.MIMESubType) if exts, _ := mime.ExtensionsByType(mimeType); len(exts) > 0 { -- cgit