postal-mime 2.4.2 → 2.4.3
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 +7 -0
- package/package.json +1 -1
- package/src/decode-strings.js +2 -19
- package/src/mime-node.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.4.3](https://github.com/postalsys/postal-mime/compare/v2.4.2...v2.4.3) (2025-01-24)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **TextDecoder:** Do not reuse text decoders to avoid spilling data from one instance to another ([8b1013e](https://github.com/postalsys/postal-mime/commit/8b1013e52c878020b3705a2e702a560114f4c081))
|
|
9
|
+
|
|
3
10
|
## [2.4.2](https://github.com/postalsys/postal-mime/compare/v2.4.1...v2.4.2) (2025-01-24)
|
|
4
11
|
|
|
5
12
|
|
package/package.json
CHANGED
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,23 +44,7 @@ export function decodeBase64(base64) {
|
|
|
46
44
|
|
|
47
45
|
export function getDecoder(charset) {
|
|
48
46
|
charset = charset || 'utf8';
|
|
49
|
-
|
|
50
|
-
return decoders.get(charset);
|
|
51
|
-
}
|
|
52
|
-
let decoder;
|
|
53
|
-
try {
|
|
54
|
-
decoder = new TextDecoder(charset);
|
|
55
|
-
} catch (err) {
|
|
56
|
-
if (charset === 'utf8') {
|
|
57
|
-
// is this even possible?
|
|
58
|
-
throw err;
|
|
59
|
-
}
|
|
60
|
-
// use default
|
|
61
|
-
return getDecoder();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
decoders.set(charset, decoder);
|
|
65
|
-
return decoder;
|
|
47
|
+
return new TextDecoder(charset);
|
|
66
48
|
}
|
|
67
49
|
|
|
68
50
|
/**
|
|
@@ -157,6 +139,7 @@ export function decodeWord(charset, encoding, str) {
|
|
|
157
139
|
export function decodeWords(str) {
|
|
158
140
|
let joinString = true;
|
|
159
141
|
let done = false;
|
|
142
|
+
|
|
160
143
|
while (!done) {
|
|
161
144
|
let result = (str || '')
|
|
162
145
|
.toString()
|