~netlandish/links-dev

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

[PATCH links] Strips, if present, the mbox From line when piping emails to the links-email binary.

Details
Message ID
<20260108001632.20467-1-peter@netlandish.com>
Sender timestamp
1767809791
DKIM signature
missing
Download raw message
Patch: +15 -1
Addresses failed header parsing when piped via Postfix.

References: https://todo.code.netlandish.com/~netlandish/links/132
---
 cmd/email/main.go | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/cmd/email/main.go b/cmd/email/main.go
index f1879fb..9461058 100644
--- a/cmd/email/main.go
+++ b/cmd/email/main.go
@@ -2,6 +2,7 @@ package main

import (
	"bufio"
	"bytes"
	"context"
	"flag"
	"fmt"
@@ -157,7 +158,20 @@ func run(logger *log.Logger) error {
}

func parseEmail(r io.Reader) (*parsedEmail, error) {
	mr, err := mail.CreateReader(r)
	data, err := io.ReadAll(r)
	if err != nil {
		return nil, err
	}

	// strip mbox "From " envelope line if present
	// (Postfix adds this when piping to programs)
	if bytes.HasPrefix(data, []byte("From ")) {
		if idx := bytes.IndexByte(data, '\n'); idx != -1 {
			data = data[idx+1:]
		}
	}

	mr, err := mail.CreateReader(bytes.NewReader(data))
	if err != nil {
		return nil, err
	}
-- 
2.52.0
Details
Message ID
<DFIS0G4GJ0B1.29RAZENB4KG4V@netlandish.com>
In-Reply-To
<20260108001632.20467-1-peter@netlandish.com> (view parent)
Sender timestamp
1767810031
DKIM signature
missing
Download raw message
Applied.

To git@git.code.netlandish.com:~netlandish/links
   c56f91e..7db696a  master -> master
Reply to thread Export thread (mbox)