Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
MIME Normalizer
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
JS Toolbox
MIME Normalizer
Commits
37770c30
Commit
37770c30
authored
3 years ago
by
Alexey Lunin
Browse files
Options
Downloads
Patches
Plain Diff
build project
parent
f792e741
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!27
Gmail to Outlook - complex text + embeded image + attachments
Pipeline
#44817
passed
3 years ago
Stage: install
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dist/PlainNormalizer/PlainNormalizer.js
+6
-0
6 additions, 0 deletions
dist/PlainNormalizer/PlainNormalizer.js
with
6 additions
and
0 deletions
dist/PlainNormalizer/PlainNormalizer.js
+
6
−
0
View file @
37770c30
...
@@ -10,6 +10,7 @@ const normalizePlainPart = (text, sealRemovalOptions) => {
...
@@ -10,6 +10,7 @@ const normalizePlainPart = (text, sealRemovalOptions) => {
if
(
sealRemovalOptions
)
{
if
(
sealRemovalOptions
)
{
text
=
removeSeal
(
text
,
sealRemovalOptions
.
sealUrl
);
text
=
removeSeal
(
text
,
sealRemovalOptions
.
sealUrl
);
}
}
text
=
cleanupImageText
(
text
);
text
=
utils_1
.
normalizeTextSpacings
(
text
);
text
=
utils_1
.
normalizeTextSpacings
(
text
);
return
text
.
trim
();
return
text
.
trim
();
};
};
...
@@ -39,6 +40,11 @@ const removeSeal = (plain, sealUrl) => {
...
@@ -39,6 +40,11 @@ const removeSeal = (plain, sealUrl) => {
.
replace
(
new
RegExp
(
sealRegex
),
""
)
.
replace
(
new
RegExp
(
sealRegex
),
""
)
.
replace
(
new
RegExp
(
sealRegexReversed
),
""
);
.
replace
(
new
RegExp
(
sealRegexReversed
),
""
);
};
};
const
cleanupImageText
=
(
plain
)
=>
{
// For cases [image: IMAGE_NAME.EXTENSION]
const
sealRegex
=
`
\\
[(image:
\\
s)(.*)
\\
]`
;
return
plain
.
replace
(
new
RegExp
(
sealRegex
),
"
[$2]
"
);
};
const
cleanupHiddenCharacters
=
(
s
)
=>
{
const
cleanupHiddenCharacters
=
(
s
)
=>
{
const
removeSymbols
=
new
RegExp
(
/
[\u
200B
]
+/g
);
const
removeSymbols
=
new
RegExp
(
/
[\u
200B
]
+/g
);
return
s
.
replace
(
removeSymbols
,
""
);
return
s
.
replace
(
removeSymbols
,
""
);
...
...
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