imapflow 1.0.84 → 1.0.87
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 +12 -0
- package/LICENSE.txt +1 -1
- package/README.md +1 -1
- package/lib/commands/list.js +2 -2
- package/lib/handler/imap-parser.js +19 -0
- package/lib/imap-flow.js +2 -2
- package/lib/tools.js +0 -6
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
- 1.0.87 - 2022-03-21
|
|
4
|
+
|
|
5
|
+
- If LIST failed then do not suppress exception
|
|
6
|
+
|
|
7
|
+
- 1.0.86 - 2022-03-14
|
|
8
|
+
|
|
9
|
+
- Do not try to decode mailbox path from utf7 as methods expect utf-8 not utf-7
|
|
10
|
+
|
|
11
|
+
- 1.0.85 - 2022-02-23
|
|
12
|
+
|
|
13
|
+
- Trim null bytes in the beginning of IMAP responses to deal with a buggy server that pads responses with null bytes
|
|
14
|
+
|
|
3
15
|
- 1.0.84 - 2022-02-17
|
|
4
16
|
|
|
5
17
|
- QRESYNC tweaks
|
package/LICENSE.txt
CHANGED
package/README.md
CHANGED
package/lib/commands/list.js
CHANGED
|
@@ -156,7 +156,7 @@ module.exports = async (connection, reference, mailbox) => {
|
|
|
156
156
|
|
|
157
157
|
return entries;
|
|
158
158
|
} catch (err) {
|
|
159
|
-
connection.log.warn({ err, cid: connection.id });
|
|
160
|
-
|
|
159
|
+
connection.log.warn({ msg: 'Failed to list folders', err, cid: connection.id });
|
|
160
|
+
throw err;
|
|
161
161
|
}
|
|
162
162
|
};
|
|
@@ -6,6 +6,21 @@ const { ParserInstance } = require('./parser-instance');
|
|
|
6
6
|
module.exports = async (command, options) => {
|
|
7
7
|
options = options || {};
|
|
8
8
|
|
|
9
|
+
let nullBytesRemoved = 0;
|
|
10
|
+
|
|
11
|
+
// special case with a buggy IMAP server where responses are padded with zero bytes
|
|
12
|
+
if (command[0] === 0) {
|
|
13
|
+
// find the first non null byte and trim
|
|
14
|
+
for (let i = 0; i < command.length; i++) {
|
|
15
|
+
if (command[i] !== 0) {
|
|
16
|
+
// trim to here
|
|
17
|
+
command = command.slice(i);
|
|
18
|
+
nullBytesRemoved = i;
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
9
24
|
const parser = new ParserInstance(command, options);
|
|
10
25
|
const response = {};
|
|
11
26
|
|
|
@@ -13,6 +28,10 @@ module.exports = async (command, options) => {
|
|
|
13
28
|
await parser.getSpace();
|
|
14
29
|
response.command = await parser.getCommand();
|
|
15
30
|
|
|
31
|
+
if (nullBytesRemoved) {
|
|
32
|
+
response.nullBytesRemoved = nullBytesRemoved;
|
|
33
|
+
}
|
|
34
|
+
|
|
16
35
|
if (['UID', 'AUTHENTICATE'].indexOf((response.command || '').toUpperCase()) >= 0) {
|
|
17
36
|
await parser.getSpace();
|
|
18
37
|
response.command += ' ' + (await parser.getElement(imapFormalSyntax.command()));
|
package/lib/imap-flow.js
CHANGED
|
@@ -424,9 +424,9 @@ class ImapFlow extends EventEmitter {
|
|
|
424
424
|
|
|
425
425
|
if (/^\d+$/.test(parsed.command) && parsed.attributes && parsed.attributes[0] && parsed.attributes[0].value === 'FETCH') {
|
|
426
426
|
// too many FETCH responses, might want to filter these out
|
|
427
|
-
this.log.trace({ src: 's', msg: logCompiled.toString(), cid: this.id });
|
|
427
|
+
this.log.trace({ src: 's', msg: logCompiled.toString(), cid: this.id, nullBytesRemoved: parsed.nullBytesRemoved });
|
|
428
428
|
} else {
|
|
429
|
-
this.log.debug({ src: 's', msg: logCompiled.toString(), cid: this.id });
|
|
429
|
+
this.log.debug({ src: 's', msg: logCompiled.toString(), cid: this.id, nullBytesRemoved: parsed.nullBytesRemoved });
|
|
430
430
|
}
|
|
431
431
|
|
|
432
432
|
if (parsed.tag === '+' && this.currentRequest && this.currentRequest.options && typeof this.currentRequest.options.onPlusTag === 'function') {
|
package/lib/tools.js
CHANGED
|
@@ -23,12 +23,6 @@ module.exports = {
|
|
|
23
23
|
} catch (err) {
|
|
24
24
|
// ignore, keep name as is
|
|
25
25
|
}
|
|
26
|
-
} else if (connection.enabled.has('UTF8=ACCEPT') && /&/.test(path)) {
|
|
27
|
-
try {
|
|
28
|
-
path = iconv.decode(Buffer.from(path), 'utf-7-imap').toString();
|
|
29
|
-
} catch (err) {
|
|
30
|
-
// ignore, keep name as is
|
|
31
|
-
}
|
|
32
26
|
}
|
|
33
27
|
|
|
34
28
|
// ensure namespace prefix if needed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "imapflow",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.87",
|
|
4
4
|
"description": "IMAP Client for Node",
|
|
5
5
|
"main": "./lib/imap-flow.js",
|
|
6
6
|
"scripts": {
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"homepage": "https://imapflow.com/",
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@babel/eslint-parser": "7.17.0",
|
|
30
|
-
"@babel/eslint-plugin": "7.
|
|
30
|
+
"@babel/eslint-plugin": "7.17.7",
|
|
31
31
|
"@babel/plugin-syntax-class-properties": "7.12.13",
|
|
32
32
|
"@babel/preset-env": "7.16.11",
|
|
33
|
-
"@types/node": "17.0.
|
|
33
|
+
"@types/node": "17.0.22",
|
|
34
34
|
"braintree-jsdoc-template": "3.3.0",
|
|
35
|
-
"eslint": "8.
|
|
35
|
+
"eslint": "8.11.0",
|
|
36
36
|
"eslint-config-nodemailer": "1.2.0",
|
|
37
|
-
"eslint-config-prettier": "8.
|
|
37
|
+
"eslint-config-prettier": "8.5.0",
|
|
38
38
|
"grunt": "1.4.1",
|
|
39
39
|
"grunt-cli": "1.4.3",
|
|
40
40
|
"grunt-contrib-nodeunit": "4.0.0",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"libmime": "5.0.0",
|
|
50
50
|
"libqp": "1.1.0",
|
|
51
51
|
"mailsplit": "5.3.1",
|
|
52
|
-
"nodemailer": "6.7.
|
|
53
|
-
"pino": "7.
|
|
52
|
+
"nodemailer": "6.7.3",
|
|
53
|
+
"pino": "7.9.1",
|
|
54
54
|
"socks": "2.6.2"
|
|
55
55
|
}
|
|
56
56
|
}
|