eml-parser-qaap 1.1.17 → 1.1.18

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/README.md CHANGED
@@ -1,27 +1,26 @@
1
- # eml-parse-vqaap
2
-
3
- # srjikMou
4
-
1
+ # eml-parse-js
5
2
  [RFC 822](https://www.w3.org/Protocols/rfc822/) EML file format parser and builder, Can be used in browser environment
6
3
 
7
- > fork from `eml-parse-vqaap`(used in Browser env) & `eml-format` (used in NodeJs env)
8
-
9
- 1. fix `eml-parse-vqaap` for parsing html from the eml with `quoted-printable`
4
+ > fork from `eml-format-js`(used in Browser env) & `eml-format` (used in NodeJs env)
5
+ 1. fix `eml-format-js` for parsing html from the eml with `quoted-printable`
10
6
  2. add `data` with `base64` in attachment
11
7
 
12
8
  ## start guide
13
9
 
14
10
  ```javascript
15
- import { parseEml, readEml, GBKUTF8, decode } from 'eml-parse-vqaap';
11
+ import { parseEml, readEml, GBKUTF8, decode } from 'eml-parse-js';
16
12
 
17
13
  // const eml = await axios(http | ajax).get()
18
- // `.eml` file
19
- readEml(eml, (err, ReadEmlJson) => {});
14
+ // `.eml` file
15
+ readEml(eml, (err, ReadEmlJson) => {
16
+
17
+ });
20
18
  ```
21
19
 
22
20
  ## @types
23
21
 
24
22
  ```typescript
23
+
25
24
  interface Attachment {
26
25
  name: string;
27
26
  contentType: string;
@@ -35,7 +34,7 @@ interface Attachment {
35
34
  }
36
35
 
37
36
  interface ReadEmlJson {
38
- attachments: Attachment;
37
+ attachments: Attachment
39
38
  date: Date | string;
40
39
  subject: string;
41
40
  from: EmailAddress | EmailAddress[] | null;
package/lib/bundle.amd.js CHANGED
@@ -1252,7 +1252,15 @@ define(['exports', 'js-base64', '@sinonjs/text-encoding'], function (exports, js
1252
1252
  }
1253
1253
  }
1254
1254
  if (result_name) {
1255
- attachment.name = decodeURI(result_name);
1255
+ attachment.name = result_name;
1256
+ if (/%[0-9A-Fa-f]{2}/.test(result_name)) {
1257
+ try {
1258
+ attachment.name = decodeURIComponent(result_name);
1259
+ }
1260
+ catch (_a) {
1261
+ attachment.name = result_name;
1262
+ }
1263
+ }
1256
1264
  }
1257
1265
  var ct = headers['Content-Type'] || headers['Content-type'];
1258
1266
  if (ct) {
package/lib/bundle.cjs.js CHANGED
@@ -1257,7 +1257,15 @@ function read(eml, options, callback) {
1257
1257
  }
1258
1258
  }
1259
1259
  if (result_name) {
1260
- attachment.name = decodeURI(result_name);
1260
+ attachment.name = result_name;
1261
+ if (/%[0-9A-Fa-f]{2}/.test(result_name)) {
1262
+ try {
1263
+ attachment.name = decodeURIComponent(result_name);
1264
+ }
1265
+ catch (_a) {
1266
+ attachment.name = result_name;
1267
+ }
1268
+ }
1261
1269
  }
1262
1270
  var ct = headers['Content-Type'] || headers['Content-type'];
1263
1271
  if (ct) {
package/lib/bundle.esm.js CHANGED
@@ -1254,7 +1254,15 @@ function read(eml, options, callback) {
1254
1254
  }
1255
1255
  }
1256
1256
  if (result_name) {
1257
- attachment.name = decodeURI(result_name);
1257
+ attachment.name = result_name;
1258
+ if (/%[0-9A-Fa-f]{2}/.test(result_name)) {
1259
+ try {
1260
+ attachment.name = decodeURIComponent(result_name);
1261
+ }
1262
+ catch (_a) {
1263
+ attachment.name = result_name;
1264
+ }
1265
+ }
1258
1266
  }
1259
1267
  var ct = headers['Content-Type'] || headers['Content-type'];
1260
1268
  if (ct) {
@@ -1253,7 +1253,15 @@
1253
1253
  }
1254
1254
  }
1255
1255
  if (result_name) {
1256
- attachment.name = decodeURI(result_name);
1256
+ attachment.name = result_name;
1257
+ if (/%[0-9A-Fa-f]{2}/.test(result_name)) {
1258
+ try {
1259
+ attachment.name = decodeURIComponent(result_name);
1260
+ }
1261
+ catch (_a) {
1262
+ attachment.name = result_name;
1263
+ }
1264
+ }
1257
1265
  }
1258
1266
  var ct = headers['Content-Type'] || headers['Content-type'];
1259
1267
  if (ct) {
package/lib/bundle.umd.js CHANGED
@@ -1256,7 +1256,15 @@
1256
1256
  }
1257
1257
  }
1258
1258
  if (result_name) {
1259
- attachment.name = decodeURI(result_name);
1259
+ attachment.name = result_name;
1260
+ if (/%[0-9A-Fa-f]{2}/.test(result_name)) {
1261
+ try {
1262
+ attachment.name = decodeURIComponent(result_name);
1263
+ }
1264
+ catch (_a) {
1265
+ attachment.name = result_name;
1266
+ }
1267
+ }
1260
1268
  }
1261
1269
  var ct = headers['Content-Type'] || headers['Content-type'];
1262
1270
  if (ct) {
package/package.json CHANGED
@@ -1,107 +1,121 @@
1
1
  {
2
- "name": "eml-parser-qaap",
3
- "version": "1.1.17",
4
- "description": "format EML file in browser env",
5
- "main": "./lib/bundle.umd.js",
6
- "module": "./lib/bundle.esm.js",
7
- "es2015": "./lib/bundle.esm.js",
8
- "esm5": "./lib/bundle.esm.js",
9
- "typings": "./dist/index.d.ts",
10
- "types": "./dist/index.d.ts",
11
- "exports": {
12
- ".": {
13
- "types": "./dist/index.d.ts",
14
- "node": "./lib/bundle.cjs.js",
15
- "require": "./lib/bundle.cjs.js",
16
- "es2015": "./lib/bundle.esm.js",
17
- "default": "./lib/bundle.esm.js"
18
- }
19
- },
20
- "scripts": {
21
- "build": "tsc",
22
- "build:es": "tsc -p ./tsconfig.es2015.json",
23
- "build:umd": "tsc -p ./tsconfig.umd.json",
24
- "build:amd": "tsc -p ./tsconfig.amd.json",
25
- "build:ts": "npm run clean:dist && npm run build && npm run build:es -- --declaration false && npm run build:umd -- --declaration false && npm run build:amd",
26
- "build:rollup": "rollup --config",
27
- "build:publish": "npm run clean:dist && npm run build && npm run build:rollup",
28
- "clean:dist": "rimraf dist",
29
- "eslint:init": "eslint --init",
30
- "lint:ci": "eslint --ext .ts src/",
31
- "lint": "eslint --fix --ext .ts src/",
32
- "link:lib": "rimraf node_modules/eml-format-js && linklocal",
33
- "prettier": "prettier --parser typescript --write src/*ts && npm run lint",
34
- "prepublishOnly": "npm run prettier && npm run build:publish && npm run test",
35
- "test": "mocha --reporter spec",
36
- "ci": "npm install"
37
- },
38
- "files": [
39
- "dist/index.d.ts",
40
- "dist/charset.d.ts",
41
- "dist/utils.d.ts",
42
- "dist/interface.d.ts",
43
- "dist/addressparser.d.ts",
44
- "src",
45
- "lib",
46
- "LICENSE"
47
- ],
48
- "private": false,
49
- "repository": {
50
- "type": "git",
51
- "url": ""
52
- },
53
- "keywords": [
54
- "eml",
55
- "eml-parse",
56
- "eml-format-js",
57
- "eml-parse-js",
58
- "typescript"
59
- ],
60
- "author": "bean",
61
- "license": "MIT",
62
- "homepage": "http://sajjad Mousavi",
63
- "contributors": [
64
- "Charlie Harding (https://github.com/c-harding)",
65
- "Pádraig Weeks (https://github.com/pmweeks98)",
66
- "Thomas Oeser (https://github.com/thomasoeser)",
67
- "Robert Scheinpflug (https://github.com/neversun)",
68
- "Bean Q (https://github.com/MQpeng)"
69
- ],
70
- "devDependencies": {
71
- "@types/node": "^17.0.21",
72
- "@types/ramda": "^0.26.36",
73
- "@typescript-eslint/eslint-plugin": "^2.11.0",
74
- "@typescript-eslint/parser": "^2.11.0",
75
- "chai": "^4.2.0",
76
- "eslint": "^6.7.2",
77
- "eslint-plugin-prettier": "^3.1.1",
78
- "linklocal": "^2.8.2",
79
- "lint-staged": "^10.5.3",
80
- "mocha": "^6.2.2",
81
- "prettier": "1.19.1",
82
- "rimraf": "^3.0.0",
83
- "rollup": "^1.27.12",
84
- "rollup-plugin-commonjs": "^10.1.0",
85
- "rollup-plugin-node-resolve": "^5.2.0",
86
- "rollup-plugin-typescript": "^1.0.1",
87
- "typescript": "^3.7.3"
88
- },
89
- "dependencies": {
90
- "@sinonjs/text-encoding": "^0.7.2",
91
- "js-base64": "^3.7.2"
92
- },
93
- "gitHooks": {
94
- "pre-commit": "lint-staged"
95
- },
96
- "lint-staged": {
97
- "src/**/*.ts": [
98
- "npm run lint",
99
- "prettier --parser typescript --write",
100
- "git add"
101
- ]
102
- },
103
- "directories": {
104
- "lib": "lib",
105
- "test": "test"
106
- }
2
+ "name": "eml-parser-qaap",
3
+ "version": "1.1.18",
4
+ "description": "format EML file in browser env",
5
+ "main": "./lib/bundle.umd.js",
6
+ "module": "./lib/bundle.esm.js",
7
+ "es2015": "./lib/bundle.esm.js",
8
+ "esm5": "./lib/bundle.esm.js",
9
+ "typings": "./dist/index.d.ts",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "node": "./lib/bundle.cjs.js",
15
+ "require": "./lib/bundle.cjs.js",
16
+ "es2015": "./lib/bundle.esm.js",
17
+ "default": "./lib/bundle.esm.js"
18
+ }
19
+ },
20
+ "scripts": {
21
+ "build": "tsc",
22
+ "build:es": "tsc -p ./tsconfig.es2015.json",
23
+ "build:umd": "tsc -p ./tsconfig.umd.json",
24
+ "build:amd": "tsc -p ./tsconfig.amd.json",
25
+ "build:ts": "npm run clean:dist && npm run build && npm run build:es -- --declaration false && npm run build:umd -- --declaration false && npm run build:amd",
26
+ "build:rollup": "rollup --config",
27
+ "build:publish": "npm run clean:dist && npm run build && npm run build:rollup",
28
+ "clean:dist": "rimraf dist",
29
+ "eslint:init": "eslint --init",
30
+ "lint:ci": "eslint --ext .ts src/",
31
+ "lint": "eslint --fix --ext .ts src/",
32
+ "link:lib": "rimraf node_modules/eml-format-js && linklocal",
33
+ "prettier": "prettier --parser typescript --write src/*ts && npm run lint",
34
+ "prepublishOnly": "npm run prettier && npm run build:publish && npm run test",
35
+ "test": "mocha --reporter spec",
36
+ "ci": "npm install"
37
+ },
38
+ "files": [
39
+ "dist/index.d.ts",
40
+ "dist/charset.d.ts",
41
+ "dist/utils.d.ts",
42
+ "dist/interface.d.ts",
43
+ "dist/addressparser.d.ts",
44
+ "src",
45
+ "lib",
46
+ "LICENSE"
47
+ ],
48
+ "private": false,
49
+ "repository": {
50
+ "type": "git",
51
+ "url": "git+https://github.com/MQpeng/eml-parse-js"
52
+ },
53
+ "keywords": [
54
+ "eml",
55
+ "eml-parse",
56
+ "eml-format-js",
57
+ "eml-parse-js",
58
+ "typescript"
59
+ ],
60
+ "author": "bean",
61
+ "license": "MIT",
62
+ "bugs": {
63
+ "url": "https://github.com/MQpeng/eml-parse-js/issues"
64
+ },
65
+ "homepage": "https://github.com/MQpeng/eml-parse-js#readme",
66
+ "contributors": [
67
+ {
68
+ "name": "Charlie Harding",
69
+ "url": "https://github.com/c-harding"
70
+ },
71
+ {
72
+ "name": "Pádraig Weeks",
73
+ "url": "https://github.com/pmweeks98"
74
+ },
75
+ {
76
+ "name": "Thomas Oeser",
77
+ "url": "https://github.com/thomasoeser"
78
+ },
79
+ {
80
+ "name": "Robert Scheinpflug",
81
+ "url": "https://github.com/neversun"
82
+ },
83
+ {
84
+ "name": "Bean Q",
85
+ "url": "https://github.com/MQpeng"
86
+ }
87
+ ],
88
+ "devDependencies": {
89
+ "@types/node": "^17.0.21",
90
+ "@types/ramda": "^0.26.36",
91
+ "@typescript-eslint/eslint-plugin": "^2.11.0",
92
+ "@typescript-eslint/parser": "^2.11.0",
93
+ "chai": "^4.2.0",
94
+ "eslint": "^6.7.2",
95
+ "eslint-plugin-prettier": "^3.1.1",
96
+ "linklocal": "^2.8.2",
97
+ "lint-staged": "^10.5.3",
98
+ "mocha": "^6.2.2",
99
+ "prettier": "1.19.1",
100
+ "rimraf": "^3.0.0",
101
+ "rollup": "^1.27.12",
102
+ "rollup-plugin-commonjs": "^10.1.0",
103
+ "rollup-plugin-node-resolve": "^5.2.0",
104
+ "rollup-plugin-typescript": "^1.0.1",
105
+ "typescript": "^3.7.3"
106
+ },
107
+ "dependencies": {
108
+ "@sinonjs/text-encoding": "^0.7.2",
109
+ "js-base64": "^3.7.2"
110
+ },
111
+ "gitHooks": {
112
+ "pre-commit": "lint-staged"
113
+ },
114
+ "lint-staged": {
115
+ "src/**/*.ts": [
116
+ "npm run lint",
117
+ "prettier --parser typescript --write",
118
+ "git add"
119
+ ]
120
+ }
107
121
  }
package/src/index.ts CHANGED
@@ -814,7 +814,15 @@ function read(
814
814
  }
815
815
  }
816
816
  if (result_name) {
817
- attachment.name = decodeURI(result_name);
817
+ attachment.name = result_name;
818
+
819
+ if (/%[0-9A-Fa-f]{2}/.test(result_name)) {
820
+ try {
821
+ attachment.name = decodeURIComponent(result_name);
822
+ } catch {
823
+ attachment.name = result_name;
824
+ }
825
+ }
818
826
  }
819
827
 
820
828
  const ct = headers['Content-Type'] || headers['Content-type'];