Skip to content

Commit 783ebc9

Browse files
committed
in case of literals return them as strings
1 parent 5a50fc4 commit 783ebc9

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

imap-core/lib/handler/imap-parser.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,11 +527,9 @@ class TokenParser {
527527
this.currentNode.value = this.options.literals.shift();
528528

529529
// only APPEND arguments are kept as Buffers
530-
/*
531530
if ((this.parent.command || '').toString().toUpperCase() !== 'APPEND') {
532531
this.currentNode.value = this.currentNode.value.toString('binary');
533532
}
534-
*/
535533

536534
this.currentNode.endPos = this.pos + i + this.currentNode.value.length;
537535

imap-core/test/imap-parser-test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,30 +344,30 @@ describe('IMAP Command Parser', function () {
344344
expect(imapHandler.parser('TAG1 CMD {4}\r\n', { literals: [Buffer.from('abcd')] }).attributes).to.deep.equal([
345345
{
346346
type: 'LITERAL',
347-
value: Buffer.from('abcd')
347+
value: 'abcd'
348348
}
349349
]);
350350

351351
expect(imapHandler.parser('TAG1 CMD {4}\r\n {4}\r\n', { literals: [Buffer.from('abcd'), Buffer.from('kere')] }).attributes).to.deep.equal([
352352
{
353353
type: 'LITERAL',
354-
value: Buffer.from('abcd')
354+
value: 'abcd'
355355
},
356356
{
357357
type: 'LITERAL',
358-
value: Buffer.from('kere')
358+
value: 'kere'
359359
}
360360
]);
361361

362362
expect(imapHandler.parser('TAG1 CMD ({4}\r\n {4}\r\n)', { literals: [Buffer.from('abcd'), Buffer.from('kere')] }).attributes).to.deep.equal([
363363
[
364364
{
365365
type: 'LITERAL',
366-
value: Buffer.from('abcd')
366+
value: 'abcd'
367367
},
368368
{
369369
type: 'LITERAL',
370-
value: Buffer.from('kere')
370+
value: 'kere'
371371
}
372372
]
373373
]);

0 commit comments

Comments
 (0)