From 40b36fed537734b3223ad81ecb7f8d5db44494a0 Mon Sep 17 00:00:00 2001 From: Andris Reinman Date: Thu, 1 Jun 2017 19:02:58 +0300 Subject: [PATCH] do not add extra newline to messages with text body for multipart --- imap-core/lib/indexer/indexer.js | 7 ++++--- imap-core/lib/length-limiter.js | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/imap-core/lib/indexer/indexer.js b/imap-core/lib/indexer/indexer.js index b8507148..91e64b7b 100644 --- a/imap-core/lib/indexer/indexer.js +++ b/imap-core/lib/indexer/indexer.js @@ -80,12 +80,13 @@ class Indexer { next(); }; - root = false; - if (node.size || node.attachmentId) { - append(false, true); // force newline + if (!root) { + append(false, true); // force newline + } size += node.size; } + root = false; if (node.boundary) { append('--' + node.boundary); diff --git a/imap-core/lib/length-limiter.js b/imap-core/lib/length-limiter.js index b21bf417..08a19335 100644 --- a/imap-core/lib/length-limiter.js +++ b/imap-core/lib/length-limiter.js @@ -37,7 +37,7 @@ class LengthLimiter extends Transform { if (this.byteCounter < this.startFrom) { // split the chunk and ignore the first part chunk = chunk.slice(this.startFrom - this.byteCounter); - this.byteCounter += (this.startFrom - this.byteCounter); + this.byteCounter += this.startFrom - this.byteCounter; } // can emit full chunk @@ -69,7 +69,6 @@ class LengthLimiter extends Transform { } done(); } - } module.exports = LengthLimiter;