From 65332c233880c9609ea39af22ee677e98f4cba1b Mon Sep 17 00:00:00 2001 From: Vitaly Ovchinnikov Date: Wed, 3 Apr 2024 12:25:05 +0000 Subject: send: prevent sending if multipart conversion failed Given the following configuration: binds.conf: [compose::review] y = :multipart text/html:send aerc.conf: [multipart-converters] text/html = /path/to/some/script.sh /path/to/some/script.sh: #!/bin/sh exit 10 # falls for some reason When you press `y` aerc runs `:multipart` command and although it gets an error from the converter script, the error is ignored and then the `:send` command actually sends a broken message. Add ConversionError field to Composer.Part to track multipart conversion errors. Check for conversion errors in :send, block sending if the errors are found. There is no way to skip this like missing attachment or empty subject. This is done intentionally. The user needs to update or delete the problematic part before actually sending a message. Signed-off-by: Vitaly Ovchinnikov Acked-by: Robin Jarry --- commands/compose/send.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'commands/compose') diff --git a/commands/compose/send.go b/commands/compose/send.go index 2e7590a0..fd39b48c 100644 --- a/commands/compose/send.go +++ b/commands/compose/send.go @@ -64,6 +64,11 @@ func (s Send) Execute(args []string) error { } composer, _ := tab.Content.(*app.Composer) + err := composer.CheckForMultipartErrors() + if err != nil { + return err + } + config := composer.Config() if s.CopyTo == "" { -- cgit