From f5d3ca4968a1788f6e55d3cc296bda5d803e7882 Mon Sep 17 00:00:00 2001 From: Glenn Wilkinson Date: Tue, 24 Mar 2020 17:26:05 +0000 Subject: [PATCH] Updated CR removal code to work on older Go versions --- imap/imap.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/imap/imap.go b/imap/imap.go index dad3c4d9..431a55d6 100644 --- a/imap/imap.go +++ b/imap/imap.go @@ -7,8 +7,8 @@ import ( "crypto/tls" "fmt" "io" + "regexp" "strconv" - "strings" "time" "github.com/emersion/go-imap" @@ -163,7 +163,8 @@ func (mbox *Mailbox) GetUnread(markAsRead, delete bool) ([]Email, error) { //Remove CR characters, see https://github.com/jordan-wright/email/issues/106 tmp := string(buf) - tmp = strings.ReplaceAll(tmp, "\r", "") + re := regexp.MustCompile(`\r`) + tmp = re.ReplaceAllString(tmp, "") buf = []byte(tmp) rawBodyStream := bytes.NewReader(buf)