Skip to content
Snippets Groups Projects
Commit 59184753 authored by Damyan Mitev's avatar Damyan Mitev :beach:
Browse files

Add leaf field to part, add non leafs to returned parts from

calculateParts
parent b99d853d
No related branches found
No related tags found
1 merge request!56Resolve "Email integrity check"
...@@ -61,7 +61,7 @@ function calculateParts(body, from, to, previousBondary) { ...@@ -61,7 +61,7 @@ function calculateParts(body, from, to, previousBondary) {
let boundary = findFirstBoundary(body, from, to); let boundary = findFirstBoundary(body, from, to);
if (boundary == null) { if (boundary == null) {
return [{ indices: { from: from, to: to }, boundary: previousBondary }]; return [{ indices: { from: from, to: to }, boundary: previousBondary, leaf: true }];
} }
const realBoundary = boundary; const realBoundary = boundary;
...@@ -78,6 +78,9 @@ function calculateParts(body, from, to, previousBondary) { ...@@ -78,6 +78,9 @@ function calculateParts(body, from, to, previousBondary) {
} }
let bodies = []; let bodies = [];
if (previousBondary !== null) {
bodies.push({indices: {from: from, to: to}, boundary: previousBondary, leaf: false});
}
for (let i = 0; i < boundaryIndicesLength - 1; i++) { for (let i = 0; i < boundaryIndicesLength - 1; i++) {
const firstPair = boundaryPairs[i]; const firstPair = boundaryPairs[i];
...@@ -155,13 +158,14 @@ export function parseMIME(mime) { ...@@ -155,13 +158,14 @@ export function parseMIME(mime) {
parts.push({ parts.push({
indices: { from: 0, to: mime.length, headersEnd: headersEnd }, indices: { from: 0, to: mime.length, headersEnd: headersEnd },
headers, headers,
boundary: "mimemessage" boundary: "mimemessage",
leaf: false
}); });
return parts; return parts;
} }
function getHeaderValue(header, part) { export function getHeaderValue(header, part) {
if (part.headers && part.headers[header] && part.headers[header].length) { if (part.headers && part.headers[header] && part.headers[header].length) {
return part.headers[header]; return part.headers[header];
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment