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
Issue boards
Milestones
Wiki
Code
Merge requests
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
ebdc3358
Commit
ebdc3358
authored
6 years ago
by
Alexey Lunin
Browse files
Options
Downloads
Patches
Plain Diff
Split email participants by comma in to, from, cc fields
parent
6b1beabe
No related branches found
No related tags found
1 merge request
!26
[Email Thread] Display registered and not registered receivers
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
javascript/package.json
+1
-0
1 addition, 0 deletions
javascript/package.json
javascript/src/helpers/mailparser.js
+5
-13
5 additions, 13 deletions
javascript/src/helpers/mailparser.js
javascript/src/utilities/emailUtilities.js
+15
-4
15 additions, 4 deletions
javascript/src/utilities/emailUtilities.js
with
21 additions
and
17 deletions
javascript/package.json
+
1
−
0
View file @
ebdc3358
...
...
@@ -28,6 +28,7 @@
"data-uri-to-blob"
:
"^0.0.4"
,
"libmime"
:
"^4.0.1"
,
"libqp"
:
"^1.1.0"
,
"lodash"
:
"^4.17.11"
,
"penpal"
:
"^3.0.3"
,
"pkijs"
:
"^2.1.69"
,
"pvutils"
:
"^1.0.16"
,
...
...
This diff is collapsed.
Click to expand it.
javascript/src/helpers/mailparser.js
+
5
−
13
View file @
ebdc3358
...
...
@@ -154,7 +154,7 @@ export function parseMIME(mime) {
parts
.
push
({
indices
:
{
from
:
0
,
to
:
mime
.
length
,
headersEnd
:
headersEnd
},
headers
:
headers
,
headers
,
boundary
:
"
mimemessage
"
});
...
...
@@ -162,19 +162,11 @@ export function parseMIME(mime) {
}
function
getHeaderValue
(
header
,
part
)
{
if
(
part
.
headers
!==
null
&&
part
.
headers
!==
undefined
)
{
if
(
part
.
headers
[
header
]
!==
null
&&
part
.
headers
[
header
]
!==
undefined
)
{
if
(
part
.
headers
[
header
].
length
>
0
)
{
return
part
.
headers
[
header
];
}
else
{
return
null
;
}
}
else
{
return
null
;
}
}
else
{
return
null
;
if
(
part
.
headers
&&
part
.
headers
[
header
]
&&
part
.
headers
[
header
].
length
)
{
return
part
.
headers
[
header
];
}
return
null
;
}
export
function
getGlobalHeaderValue
(
header
,
parts
)
{
...
...
This diff is collapsed.
Click to expand it.
javascript/src/utilities/emailUtilities.js
+
15
−
4
View file @
ebdc3358
import
dataUriToBlob
from
"
data-uri-to-blob
"
;
import
libmime
from
'
libmime
'
;
import
map
from
'
lodash/map
'
;
import
union
from
'
lodash/union
'
;
import
{
fixNewLines
,
...
...
@@ -15,6 +17,11 @@ import { getCertificateChain } from "./signingUtilities";
const
SIGNATURE_CONTENT_TYPE
=
"
application/pkcs7-signature
"
;
export
const
DEFAULT_ATTACHMENT_NAME
=
'
attachment
'
;
const
splitParticipants
=
participantsList
=>
{
const
participants
=
map
(
participantsList
,
participants
=>
participants
.
split
(
"
,
"
).
map
(
p
=>
p
.
trim
()));
return
union
.
apply
(
null
,
participants
);
};
export
const
parseSMIME
=
smimeString
=>
{
return
new
Promise
(
resolve
=>
{
setTimeout
(
async
()
=>
{
...
...
@@ -48,10 +55,14 @@ export const parseSMIME = smimeString => {
const
certificateChain
=
getCertificateChain
(
signatureBase64
);
const
from
=
splitParticipants
(
getGlobalHeaderValue
(
"
from
"
,
parts
));
const
to
=
splitParticipants
(
getGlobalHeaderValue
(
"
to
"
,
parts
));
const
cc
=
splitParticipants
(
getGlobalHeaderValue
(
"
cc
"
,
parts
));
const
message
=
{
from
:
getGlobalHeaderValue
(
"
from
"
,
parts
)
,
to
:
getGlobalHeaderValue
(
"
to
"
,
parts
)
,
cc
:
getGlobalHeaderValue
(
"
cc
"
,
parts
)
,
from
,
to
,
cc
,
subject
:
getGlobalHeaderValue
(
"
subject
"
,
parts
).
join
(
"
"
),
html
:
extractHtmlBodyFromString
(
html
),
plain
,
...
...
@@ -101,4 +112,4 @@ export const extractHtmlBodyFromString = string => {
}
return
body
;
};
\ No newline at end of file
};
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