imapflow 1.0.95 → 1.0.96

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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ - 1.0.96 - 2022-05-18
4
+
5
+ - Allow non-standard characters in ATOM if it's the string after NO/OK/BAD response
6
+
3
7
  - 1.0.95 - 2022-05-03
4
8
 
5
9
  - Do not use FETCH BINARY, unless `binary` option is `true`
@@ -332,7 +332,12 @@ class TokenParser {
332
332
  }
333
333
 
334
334
  // if the char is not ATOM compatible, throw. Allow \* as an exception
335
- if (imapFormalSyntax['ATOM-CHAR']().indexOf(chr) < 0 && chr !== ']' && !(chr === '*' && this.currentNode.value === '\\')) {
335
+ if (
336
+ imapFormalSyntax['ATOM-CHAR']().indexOf(chr) < 0 &&
337
+ chr !== ']' &&
338
+ !(chr === '*' && this.currentNode.value === '\\') &&
339
+ (!this.parent || !this.parent.command || !['NO', 'BAD', 'OK'].includes(this.parent.command))
340
+ ) {
336
341
  throw new Error('Unexpected char at position ' + (this.pos + i));
337
342
  } else if (this.currentNode.value === '\\*') {
338
343
  throw new Error('Unexpected char at position ' + (this.pos + i));
package/lib/imap-flow.js CHANGED
@@ -623,7 +623,7 @@ class ImapFlow extends EventEmitter {
623
623
 
624
624
  // Make sure we have namespace set. This should also throw if Exchange actually failed authentication
625
625
  let nsResponse = await this.run('NAMESPACE');
626
- if (nsResponse.error && nsResponse.status === 'BAD' && /User is authenticated but not connected/i.test(nsResponse.text)) {
626
+ if (nsResponse && nsResponse.error && nsResponse.status === 'BAD' && /User is authenticated but not connected/i.test(nsResponse.text)) {
627
627
  // Not a NAMESPACE failure but authentication failure, so report as
628
628
  this.authenticated = false;
629
629
  let err = new Error('Authentication failed');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imapflow",
3
- "version": "1.0.95",
3
+ "version": "1.0.96",
4
4
  "description": "IMAP Client for Node",
5
5
  "main": "./lib/imap-flow.js",
6
6
  "scripts": {
@@ -30,13 +30,13 @@
30
30
  "@babel/eslint-parser": "7.17.0",
31
31
  "@babel/eslint-plugin": "7.17.7",
32
32
  "@babel/plugin-syntax-class-properties": "7.12.13",
33
- "@babel/preset-env": "7.17.10",
34
- "@types/node": "17.0.31",
33
+ "@babel/preset-env": "7.17.12",
34
+ "@types/node": "17.0.34",
35
35
  "braintree-jsdoc-template": "3.3.0",
36
- "eslint": "8.14.0",
36
+ "eslint": "8.15.0",
37
37
  "eslint-config-nodemailer": "1.2.0",
38
38
  "eslint-config-prettier": "8.5.0",
39
- "grunt": "1.5.2",
39
+ "grunt": "1.5.3",
40
40
  "grunt-cli": "1.4.3",
41
41
  "grunt-contrib-nodeunit": "4.0.0",
42
42
  "grunt-eslint": "24.0.0",
@@ -51,7 +51,7 @@
51
51
  "libmime": "5.1.0",
52
52
  "libqp": "1.1.0",
53
53
  "mailsplit": "5.3.2",
54
- "nodemailer": "6.7.4",
54
+ "nodemailer": "6.7.5",
55
55
  "pino": "7.11.0",
56
56
  "socks": "2.6.2"
57
57
  }
@@ -905,3 +905,19 @@ module.exports['IMAP Parser: escaped quotes'] = test =>
905
905
  );
906
906
 
907
907
  module.exports['IMAP Parser: mimetorture'] = test => asyncWrapper(test, async test => test.deepEqual(await parser(mimetorture.input), mimetorture.output));
908
+
909
+ module.exports['IMAP Parser, unicode select'] = test =>
910
+ asyncWrapper(test, async test =>
911
+ test.deepEqual((await parser('F OK [READ-WRITE] [Gmail]/Visi laiškai selected. (Success) [THROTTLED]')).attributes, [
912
+ {
913
+ type: 'ATOM',
914
+ value: '',
915
+ section: [{ type: 'ATOM', value: 'READ-WRITE' }]
916
+ },
917
+ { type: 'ATOM', value: '[Gmail]/Visi' },
918
+ { type: 'ATOM', value: 'laiškai' },
919
+ { type: 'ATOM', value: 'selected.' },
920
+ [{ type: 'ATOM', value: 'Success' }],
921
+ { type: 'ATOM', value: '[THROTTLED]' }
922
+ ])
923
+ );