From 21db956bec5292faebeb1b51fbb0f7e1a5c137a3 Mon Sep 17 00:00:00 2001 From: Simon Fondrie-Teitler Date: Mon, 11 Sep 2017 15:12:36 -0400 Subject: [PATCH] Convert the body to uppercase before parsing This allows for matching header flags where the case of the flags in the return data is different than the case in the request. Fixes #639 --- lib/Connection.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Connection.js b/lib/Connection.js index 619862ff..a462a4bf 100644 --- a/lib/Connection.js +++ b/lib/Connection.js @@ -213,7 +213,10 @@ Connection.prototype.connect = function() { // because 'HEADER.FIELDS (TO FROM)' really is equivalent to // 'HEADER.FIELDS ("TO" "FROM")' and some servers will actually send the // quoted form even if the client did not use quotes - var thisbody = parseExpr(info.which); + // It also converts the body to upper case, since the IMAP RFC + // states that flags should be matched in a case insensitive + // manner. + var thisbody = parseExpr(info.which.toUpperCase()); for (var i = 0, len = toget.length; i < len; ++i) { if (_deepEqual(thisbody, toget[i])) { toget.splice(i, 1);