Some emails can have a bad encoding, a bad charset, a bad header
field, etc. Skip these so that we can try to return a partial thread.
Ideally we'd return a list of errors alongside the partial thread,
but gqlgen doesn't support this yet.
---
api/graph/schema.resolvers.go | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/api/graph/schema.resolvers.go b/api/graph/schema.resolvers.go
index 7d6692d16121..89f799c986bf 100644
--- a/api/graph/schema.resolvers.go+++ b/api/graph/schema.resolvers.go
@@ -10,6 +10,7 @@ import (
"errors"
"fmt"
"io"
+ "log" "net/url"
"strings"
"time"
@@ -1827,12 +1828,14 @@ func (r *threadResolver) Blocks(ctx context.Context, obj *model.Thread) ([]*mode
mr, err := mail.CreateReader(bytes.NewReader(email.RawEnvelope))
if err != nil {
- return fmt.Errorf("failed to create mail reader: %v", err)+ log.Printf("Failed to create reader for email %v: %v", email.ID, err)+ continue }
header := mr.Header
text, err := getMailText(mr)
if err != nil {
- return fmt.Errorf("failed to get mail text: %v", err)+ log.Printf("Failed to get mail text for email %v: %v", email.ID, err)+ continue }
mr.Close()
base-commit: fdc1c4c7c546ed32e42c8f014873e94c2e7d91f1
--
2.39.2
[PATCH lists.sr.ht 2/2] Make thread block parsing errors non-fatal
Export this patch