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?
This commit is contained in:
Ben Fiedler 2020-04-24 16:25:13 +02:00 committed by Drew DeVault
parent 3102ac3680
commit 92f59ef94a
1 changed files with 4 additions and 3 deletions

View File

@ -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{