imapflow 1.0.187 → 1.0.189
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/lib/handler/imap-parser.js +8 -3
- package/lib/handler/token-parser.js +2 -21
- package/lib/imap-flow.d.ts +786 -0
- package/lib/imap-flow.js +224 -92
- package/package.json +12 -12
- package/test/imap-parser-test.js +14 -4
- package/lib/types.d.ts +0 -1123
- package/types.js +0 -56
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.0.189](https://github.com/postalsys/imapflow/compare/v1.0.188...v1.0.189) (2025-06-30)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* improved error handling ([0b955e4](https://github.com/postalsys/imapflow/commit/0b955e4e4a4ce05cae61ae603b68b84f3e19539c))
|
|
9
|
+
* Remove diacritics in ID values ([c79df56](https://github.com/postalsys/imapflow/commit/c79df5619f3cc6db36d3657a4746a112d2f33b15))
|
|
10
|
+
|
|
11
|
+
## [1.0.188](https://github.com/postalsys/imapflow/compare/v1.0.187...v1.0.188) (2025-06-13)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* **atom:** Allow < and [ in an atom value ([53b96bb](https://github.com/postalsys/imapflow/commit/53b96bb347705bd96efa3bd2503784d5f501f728))
|
|
17
|
+
|
|
3
18
|
## [1.0.187](https://github.com/postalsys/imapflow/compare/v1.0.186...v1.0.187) (2025-05-20)
|
|
4
19
|
|
|
5
20
|
|
|
@@ -11,14 +11,19 @@ module.exports = async (command, options) => {
|
|
|
11
11
|
// special case with a buggy IMAP server where responses are padded with zero bytes
|
|
12
12
|
if (command[0] === 0) {
|
|
13
13
|
// find the first non null byte and trim
|
|
14
|
+
let firstNonNull = -1;
|
|
14
15
|
for (let i = 0; i < command.length; i++) {
|
|
15
16
|
if (command[i] !== 0) {
|
|
16
|
-
|
|
17
|
-
command = command.slice(i);
|
|
18
|
-
nullBytesRemoved = i;
|
|
17
|
+
firstNonNull = i;
|
|
19
18
|
break;
|
|
20
19
|
}
|
|
21
20
|
}
|
|
21
|
+
if (firstNonNull === -1) {
|
|
22
|
+
// All bytes are null
|
|
23
|
+
return { tag: '*', command: 'BAD', attributes: [] };
|
|
24
|
+
}
|
|
25
|
+
command = command.slice(firstNonNull);
|
|
26
|
+
nullBytesRemoved = firstNonNull;
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
const parser = new ParserInstance(command, options);
|
|
@@ -364,20 +364,8 @@ class TokenParser {
|
|
|
364
364
|
}
|
|
365
365
|
|
|
366
366
|
// [ starts a section group for this element
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
if (['BODY', 'BODY.PEEK', 'BINARY', 'BINARY.PEEK'].indexOf(this.currentNode.value.toUpperCase()) < 0) {
|
|
370
|
-
if (/[./]/.test(this.currentNode.value)) {
|
|
371
|
-
// could be a path
|
|
372
|
-
this.currentNode.value += chr;
|
|
373
|
-
break;
|
|
374
|
-
} else {
|
|
375
|
-
let error = new Error(`Unexpected section start char [ at position ${this.pos + i} [E14]`);
|
|
376
|
-
error.code = 'ParserError14';
|
|
377
|
-
error.parserContext = { input: this.str, pos: this.pos + i, chr };
|
|
378
|
-
throw error;
|
|
379
|
-
}
|
|
380
|
-
}
|
|
367
|
+
// Allowed only for selected elements, otherwise falls through to regular ATOM processing
|
|
368
|
+
if (chr === '[' && ['BODY', 'BODY.PEEK', 'BINARY', 'BINARY.PEEK'].indexOf(this.currentNode.value.toUpperCase()) >= 0) {
|
|
381
369
|
this.currentNode.endPos = this.pos + i;
|
|
382
370
|
this.currentNode = this.createNode(this.currentNode.parentNode, this.pos + i);
|
|
383
371
|
this.currentNode.type = 'SECTION';
|
|
@@ -386,13 +374,6 @@ class TokenParser {
|
|
|
386
374
|
break;
|
|
387
375
|
}
|
|
388
376
|
|
|
389
|
-
if (chr === '<') {
|
|
390
|
-
let error = new Error(`Unexpected start of partial at position ${this.pos + i} [E15]`);
|
|
391
|
-
error.code = 'ParserError15';
|
|
392
|
-
error.parserContext = { input: this.str, pos: this.pos + i, chr };
|
|
393
|
-
throw error;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
377
|
// if the char is not ATOM compatible, throw. Allow \* as an exception
|
|
397
378
|
if (
|
|
398
379
|
imapFormalSyntax['ATOM-CHAR']().indexOf(chr) < 0 &&
|