mailto: allow empty recipient field

Allow a mailto link to open a new composer even if no recipient is in
the url.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: Moritz Poldrack <git@moritz.sh>
This commit is contained in:
Tim Culverhouse 2022-03-17 19:36:19 -05:00 committed by Robin Jarry
parent a0fceb80b3
commit 62a5ebb1e1
1 changed files with 4 additions and 1 deletions

View File

@ -527,7 +527,7 @@ func (aerc *Aerc) Mailto(addr *url.URL) error {
var subject string
h := &mail.Header{}
to, err := mail.ParseAddressList(addr.Opaque)
if err != nil {
if err != nil && addr.Opaque != "" {
return fmt.Errorf("Could not parse to: %v", err)
}
h.SetAddressList("to", to)
@ -567,6 +567,9 @@ func (aerc *Aerc) Mailto(addr *url.URL) error {
title = subject
composer.FocusTerminal()
}
if to == nil {
composer.FocusRecipient()
}
tab := aerc.NewTab(composer, title)
composer.OnHeaderChange("Subject", func(subject string) {
if subject == "" {