From a9870dfce97d3916300b04c00fab9f0294786e7d Mon Sep 17 00:00:00 2001 From: Brian White Date: Fri, 4 Jan 2013 02:27:02 -0500 Subject: [PATCH] fix multiple header fetch parsing --- lib/imap.parsers.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/imap.parsers.js b/lib/imap.parsers.js index 85d51e5..f988fdf 100644 --- a/lib/imap.parsers.js +++ b/lib/imap.parsers.js @@ -104,9 +104,12 @@ exports.parseFetchBodies = function(str, literals) { else if (typeof result[i][0] += '>'; }*/ else if (result[i].length > 1) { - // HEADER.FIELDS (foo) + // HEADER.FIELDS (foo) or HEADER.FIELDS (foo bar baz) result[i][0] += ' ('; - result[i][0] += result[i].slice(1).join(' '); + if (Array.isArray(result[i][1])) + result[i][0] += result[i][1].join(' '); + else + result[i][0] += result[i].slice(1).join(' '); result[i][0] += ')'; } if (bodies === undefined)