From 92f59ef94af4ce936a5ea3a4407360e558317744 Mon Sep 17 00:00:00 2001 From: Ben Fiedler Date: Fri, 24 Apr 2020 16:25:13 +0200 Subject: imap/fetch.go: report error when fetching headers fails Correct me if I'm wrong, but shouldn't this raise an error when it fails? --- worker/imap/fetch.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/worker/imap/fetch.go b/worker/imap/fetch.go index bc7144c..9591ced 100644 --- a/worker/imap/fetch.go +++ b/worker/imap/fetch.go @@ -82,10 +82,11 @@ func (imapw *IMAPWorker) handleFetchMessages( case *types.FetchMessageHeaders: reader := _msg.GetBody(section) textprotoHeader, err := textproto.ReadHeader(bufio.NewReader(reader)) - var header *mail.Header - if err == nil { - header = &mail.Header{message.Header{textprotoHeader}} + if err != nil { + done <- fmt.Errorf("could not read header: %v", err) + return } + header := &mail.Header{message.Header{textprotoHeader}} imapw.worker.PostMessage(&types.MessageInfo{ Message: types.RespondTo(msg), Info: &models.MessageInfo{ -- cgit v1.2.3