postal-mime 2.7.0 → 2.7.1
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/dist/postal-mime.cjs +7 -4
- package/package.json +1 -1
- package/src/postal-mime.js +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.7.1](https://github.com/postalsys/postal-mime/compare/v2.7.0...v2.7.1) (2025-12-22)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* Add null checks for contentDisposition.parsed access ([fd54c37](https://github.com/postalsys/postal-mime/commit/fd54c37093cc64737c6bb17986bc9d052d2d5add))
|
|
9
|
+
|
|
3
10
|
## [2.7.0](https://github.com/postalsys/postal-mime/compare/v2.6.1...v2.7.0) (2025-12-22)
|
|
4
11
|
|
|
5
12
|
|
package/dist/postal-mime.cjs
CHANGED
|
@@ -134,6 +134,7 @@ class PostalMime {
|
|
|
134
134
|
let textMap = this.textMap = /* @__PURE__ */ new Map();
|
|
135
135
|
let forceRfc822Attachments = this.forceRfc822Attachments();
|
|
136
136
|
let walk = async (node, alternative, related) => {
|
|
137
|
+
var _a, _b, _c, _d, _e;
|
|
137
138
|
alternative = alternative || false;
|
|
138
139
|
related = related || false;
|
|
139
140
|
if (!node.contentType.multipart) {
|
|
@@ -173,11 +174,11 @@ class PostalMime {
|
|
|
173
174
|
textEntry[textType].push({ type: "text", value: node.getTextContent() });
|
|
174
175
|
textTypes.add(textType);
|
|
175
176
|
} else if (node.content) {
|
|
176
|
-
const filename = node.contentDisposition.parsed.params.filename || node.contentType.parsed.params.name || null;
|
|
177
|
+
const filename = ((_c = (_b = (_a = node.contentDisposition) == null ? void 0 : _a.parsed) == null ? void 0 : _b.params) == null ? void 0 : _c.filename) || node.contentType.parsed.params.name || null;
|
|
177
178
|
const attachment = {
|
|
178
179
|
filename: filename ? (0, import_decode_strings.decodeWords)(filename) : null,
|
|
179
180
|
mimeType: node.contentType.parsed.value,
|
|
180
|
-
disposition: node.contentDisposition.parsed.value || null
|
|
181
|
+
disposition: ((_e = (_d = node.contentDisposition) == null ? void 0 : _d.parsed) == null ? void 0 : _e.value) || null
|
|
181
182
|
};
|
|
182
183
|
if (related && node.contentId) {
|
|
183
184
|
attachment.related = true;
|
|
@@ -285,7 +286,8 @@ class PostalMime {
|
|
|
285
286
|
this.textContent = textContent;
|
|
286
287
|
}
|
|
287
288
|
isInlineTextNode(node) {
|
|
288
|
-
|
|
289
|
+
var _a, _b;
|
|
290
|
+
if (((_b = (_a = node.contentDisposition) == null ? void 0 : _a.parsed) == null ? void 0 : _b.value) === "attachment") {
|
|
289
291
|
return false;
|
|
290
292
|
}
|
|
291
293
|
switch (node.contentType.parsed.value) {
|
|
@@ -299,10 +301,11 @@ class PostalMime {
|
|
|
299
301
|
}
|
|
300
302
|
}
|
|
301
303
|
isInlineMessageRfc822(node) {
|
|
304
|
+
var _a, _b;
|
|
302
305
|
if (node.contentType.parsed.value !== "message/rfc822") {
|
|
303
306
|
return false;
|
|
304
307
|
}
|
|
305
|
-
let disposition = node.contentDisposition.parsed.value || (this.options.rfc822Attachments ? "attachment" : "inline");
|
|
308
|
+
let disposition = ((_b = (_a = node.contentDisposition) == null ? void 0 : _a.parsed) == null ? void 0 : _b.value) || (this.options.rfc822Attachments ? "attachment" : "inline");
|
|
306
309
|
return disposition === "inline";
|
|
307
310
|
}
|
|
308
311
|
// Check if this is a specially crafted report email where message/rfc822 content should not be inlined
|
package/package.json
CHANGED
package/src/postal-mime.js
CHANGED
|
@@ -200,11 +200,11 @@ export default class PostalMime {
|
|
|
200
200
|
// is it an attachment
|
|
201
201
|
else if (node.content) {
|
|
202
202
|
const filename =
|
|
203
|
-
node.contentDisposition
|
|
203
|
+
node.contentDisposition?.parsed?.params?.filename || node.contentType.parsed.params.name || null;
|
|
204
204
|
const attachment = {
|
|
205
205
|
filename: filename ? decodeWords(filename) : null,
|
|
206
206
|
mimeType: node.contentType.parsed.value,
|
|
207
|
-
disposition: node.contentDisposition
|
|
207
|
+
disposition: node.contentDisposition?.parsed?.value || null
|
|
208
208
|
};
|
|
209
209
|
|
|
210
210
|
if (related && node.contentId) {
|
|
@@ -333,7 +333,7 @@ export default class PostalMime {
|
|
|
333
333
|
}
|
|
334
334
|
|
|
335
335
|
isInlineTextNode(node) {
|
|
336
|
-
if (node.contentDisposition
|
|
336
|
+
if (node.contentDisposition?.parsed?.value === 'attachment') {
|
|
337
337
|
// no matter the type, this is an attachment
|
|
338
338
|
return false;
|
|
339
339
|
}
|
|
@@ -355,7 +355,7 @@ export default class PostalMime {
|
|
|
355
355
|
return false;
|
|
356
356
|
}
|
|
357
357
|
let disposition =
|
|
358
|
-
node.contentDisposition
|
|
358
|
+
node.contentDisposition?.parsed?.value || (this.options.rfc822Attachments ? 'attachment' : 'inline');
|
|
359
359
|
return disposition === 'inline';
|
|
360
360
|
}
|
|
361
361
|
|