This commit is contained in:
Andris Reinman 2017-10-27 12:45:57 +03:00
parent 498b96e0d6
commit 93857d4edb
4 changed files with 9 additions and 6 deletions

View file

@ -216,7 +216,7 @@ module.exports = function(response, isLogging) {
let finalize = () => {
if (node.partial) {
resp += '<' + node.partial.join('.') + '>';
resp += '<' + node.partial[0] + '>';
}
setImmediate(callback);
};

View file

@ -370,7 +370,7 @@ class Indexer {
// remove attachments and very large text nodes from the mime tree
if (!isMultipart && node.body && node.body.length && (!isInlineText || node.size > 300 * 1024)) {
let attachmentId = 'ATT' + (++idcount).toString().padStart(5, '0');
let attachmentId = 'ATT' + leftPad(++idcount, '0', 5);
let fileName =
(node.parsedHeader['content-disposition'] &&
@ -784,4 +784,8 @@ function textToHtml(str) {
return text;
}
function leftPad(val, chr, len) {
return chr.repeat(len - val.toString().length) + val;
}
module.exports = Indexer;

View file

@ -1364,7 +1364,7 @@ describe('IMAP Protocol integration tests', function() {
},
function(resp) {
resp = resp.toString();
expect(resp.indexOf('\n* 4 FETCH (BODY[]<4.5> {5}\r\n: sen)\r\n') >= 0).to.be.true;
expect(resp.indexOf('\n* 4 FETCH (BODY[]<4> {5}\r\n: sen)\r\n') >= 0).to.be.true;
expect(
resp.indexOf(
'\n* 4 FETCH (BODY[]<4> {93}\r\n: sender@example.com\r\nto: to@example.com\r\ncc: cc@example.com\r\nsubject: test\r\n\r\nHello World!\r\n)\r\n'

View file

@ -311,10 +311,9 @@ class FilterHandler {
recipient,
targets: forwardTargets.size
? Array.from(forwardTargets).map((row, i) => ({
? Array.from(forwardTargets).map(row => ({
type: row[1].type,
value: row[1].value,
seq: (i + 1).toString(16).padStart(3, '0')
value: row[1].value
}))
: false,