Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
Vereign Client Library
Manage
Activity
Members
Labels
Plan
Issues
24
Issue boards
Milestones
Wiki
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Code
Vereign Client Library
Commits
59184753
Commit
59184753
authored
5 years ago
by
Damyan Mitev
Browse files
Options
Downloads
Patches
Plain Diff
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
!56
Resolve "Email integrity check"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
javascript/src/helpers/mailparser.js
+7
-3
7 additions, 3 deletions
javascript/src/helpers/mailparser.js
with
7 additions
and
3 deletions
javascript/src/helpers/mailparser.js
+
7
−
3
View file @
59184753
...
...
@@ -61,7 +61,7 @@ function calculateParts(body, from, to, previousBondary) {
let
boundary
=
findFirstBoundary
(
body
,
from
,
to
);
if
(
boundary
==
null
)
{
return
[{
indices
:
{
from
:
from
,
to
:
to
},
boundary
:
previousBondary
}];
return
[{
indices
:
{
from
:
from
,
to
:
to
},
boundary
:
previousBondary
,
leaf
:
true
}];
}
const
realBoundary
=
boundary
;
...
...
@@ -78,6 +78,9 @@ function calculateParts(body, from, to, previousBondary) {
}
let
bodies
=
[];
if
(
previousBondary
!==
null
)
{
bodies
.
push
({
indices
:
{
from
:
from
,
to
:
to
},
boundary
:
previousBondary
,
leaf
:
false
});
}
for
(
let
i
=
0
;
i
<
boundaryIndicesLength
-
1
;
i
++
)
{
const
firstPair
=
boundaryPairs
[
i
];
...
...
@@ -155,13 +158,14 @@ export function parseMIME(mime) {
parts
.
push
({
indices
:
{
from
:
0
,
to
:
mime
.
length
,
headersEnd
:
headersEnd
},
headers
,
boundary
:
"
mimemessage
"
boundary
:
"
mimemessage
"
,
leaf
:
false
});
return
parts
;
}
function
getHeaderValue
(
header
,
part
)
{
export
function
getHeaderValue
(
header
,
part
)
{
if
(
part
.
headers
&&
part
.
headers
[
header
]
&&
part
.
headers
[
header
].
length
)
{
return
part
.
headers
[
header
];
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment