postal-mime 2.4.2 → 2.4.4
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 +14 -0
- package/package.json +2 -2
- package/src/decode-strings.js +3 -12
- package/src/mime-node.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.4.4](https://github.com/postalsys/postal-mime/compare/v2.4.3...v2.4.4) (2025-06-26)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **TextDecoder:** Fall back to windows-1252 for an unknown charset instead of throwing ([d5b917d](https://github.com/postalsys/postal-mime/commit/d5b917d5b09fab9183733cd76ebdc896467ae31e))
|
|
9
|
+
|
|
10
|
+
## [2.4.3](https://github.com/postalsys/postal-mime/compare/v2.4.2...v2.4.3) (2025-01-24)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **TextDecoder:** Do not reuse text decoders to avoid spilling data from one instance to another ([8b1013e](https://github.com/postalsys/postal-mime/commit/8b1013e52c878020b3705a2e702a560114f4c081))
|
|
16
|
+
|
|
3
17
|
## [2.4.2](https://github.com/postalsys/postal-mime/compare/v2.4.1...v2.4.2) (2025-01-24)
|
|
4
18
|
|
|
5
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postal-mime",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.4",
|
|
4
4
|
"description": "Email parser for browser environments",
|
|
5
5
|
"main": "./src/postal-mime.js",
|
|
6
6
|
"exports": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"author": "Andris Reinman",
|
|
29
29
|
"license": "MIT-0",
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@types/node": "
|
|
31
|
+
"@types/node": "24.0.4",
|
|
32
32
|
"cross-blob": "3.0.2",
|
|
33
33
|
"cross-env": "7.0.3",
|
|
34
34
|
"eslint": "8.57.0",
|
package/src/decode-strings.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export const textEncoder = new TextEncoder();
|
|
2
2
|
|
|
3
|
-
const decoders = new Map();
|
|
4
|
-
|
|
5
3
|
const base64Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
6
4
|
|
|
7
5
|
// Use a lookup table to find the index.
|
|
@@ -46,22 +44,14 @@ export function decodeBase64(base64) {
|
|
|
46
44
|
|
|
47
45
|
export function getDecoder(charset) {
|
|
48
46
|
charset = charset || 'utf8';
|
|
49
|
-
if (decoders.has(charset)) {
|
|
50
|
-
return decoders.get(charset);
|
|
51
|
-
}
|
|
52
47
|
let decoder;
|
|
48
|
+
|
|
53
49
|
try {
|
|
54
50
|
decoder = new TextDecoder(charset);
|
|
55
51
|
} catch (err) {
|
|
56
|
-
|
|
57
|
-
// is this even possible?
|
|
58
|
-
throw err;
|
|
59
|
-
}
|
|
60
|
-
// use default
|
|
61
|
-
return getDecoder();
|
|
52
|
+
decoder = new TextDecoder('windows-1252');
|
|
62
53
|
}
|
|
63
54
|
|
|
64
|
-
decoders.set(charset, decoder);
|
|
65
55
|
return decoder;
|
|
66
56
|
}
|
|
67
57
|
|
|
@@ -157,6 +147,7 @@ export function decodeWord(charset, encoding, str) {
|
|
|
157
147
|
export function decodeWords(str) {
|
|
158
148
|
let joinString = true;
|
|
159
149
|
let done = false;
|
|
150
|
+
|
|
160
151
|
while (!done) {
|
|
161
152
|
let result = (str || '')
|
|
162
153
|
.toString()
|