~sircmpwn/aerc

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[PATCH] fix problem with undisclosed recipient showing up in To:

Details
Message ID
<20200830170532.35877-1-joost@joo.st>
DKIM signature
pass
Download raw message
Patch: +4 -1
---
Currently, at least in imap, when doing reply-all to a message sent from
gmail (others could be affected to) with no emails in To or CC (only
bcc) the header contains "undisclosed-recipients:;". This gets parsed by
go-imap as "<undisclosed-recipients@>, <@>" (so actually two
addresses!). If we do reply all, aerc actually adds these malformed
emails to the To: field.

This patch adds an extra filter to see if emails are parseable (I
believe From and ReplyTo cannot be malformed so the filter is not
applied there).

This proposed solution is quite ugly. I think the correct behaviour
could be for go-imap to parse "undisclosed-recipients:;" as a name, and
then for aerc to filter out all addresses without an addr.Address in the
reply.


 commands/msg/reply.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/commands/msg/reply.go b/commands/msg/reply.go
index 3c8016e..2f79706 100644
--- a/commands/msg/reply.go
+++ b/commands/msg/reply.go
@@ -119,7 +119,10 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error {

		envTos := make([]*models.Address, 0, len(msg.Envelope.To))
		for _, addr := range msg.Envelope.To {
			if recSet.Contains(addr) {
			// Make sure the address is an actual adress
			// this filters "undisclosed recipients"
			_, err := format.ParseAddress(addr.Address)
			if err != nil || recSet.Contains(addr) {
				continue
			}
			envTos = append(envTos, addr)
-- 
2.28.0
Review patch Export thread (mbox)