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 <tim@timculverhouse.com> Acked-by: Koni Marti <koni.marti@gmail.com>
This commit is contained in:
parent
5205951149
commit
96db50c4f0
|
@ -52,7 +52,7 @@ func (Open) Execute(aerc *widgets.Aerc, args []string) error {
|
||||||
mv.MessageView().FetchBodyPart(p.Index, func(reader io.Reader) {
|
mv.MessageView().FetchBodyPart(p.Index, func(reader io.Reader) {
|
||||||
extension := ""
|
extension := ""
|
||||||
// try to determine the correct extension based on mimetype
|
// 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)
|
mimeType := fmt.Sprintf("%s/%s", part.MIMEType, part.MIMESubType)
|
||||||
|
|
||||||
if exts, _ := mime.ExtensionsByType(mimeType); len(exts) > 0 {
|
if exts, _ := mime.ExtensionsByType(mimeType); len(exts) > 0 {
|
||||||
|
|
Loading…
Reference in New Issue