Skip to content
Snippets Groups Projects
Commit f792e741 authored by Alexey Lunin's avatar Alexey Lunin
Browse files

fix for https://code.vereign.com/seal/clients/outlook-add-in/-/issues/122. For...

fix for https://code.vereign.com/seal/clients/outlook-add-in/-/issues/122. For some reason outlook transform plain text [image: IMAGENAME.EXTENSION] as [IMAGENAME.EXTENSION]
parent 9830b472
No related branches found
No related tags found
1 merge request!27Gmail to Outlook - complex text + embeded image + attachments
Pipeline #44518 passed with stages
in 55 seconds
...@@ -18,6 +18,8 @@ export const normalizePlainPart = ( ...@@ -18,6 +18,8 @@ export const normalizePlainPart = (
if (sealRemovalOptions) { if (sealRemovalOptions) {
text = removeSeal(text, sealRemovalOptions.sealUrl); text = removeSeal(text, sealRemovalOptions.sealUrl);
} }
text = cleanupImageText(text);
text = normalizeTextSpacings(text); text = normalizeTextSpacings(text);
return text.trim(); return text.trim();
...@@ -56,6 +58,13 @@ const removeSeal = (plain: string, sealUrl: string): string => { ...@@ -56,6 +58,13 @@ const removeSeal = (plain: string, sealUrl: string): string => {
.replace(new RegExp(sealRegexReversed), ""); .replace(new RegExp(sealRegexReversed), "");
}; };
const cleanupImageText = (plain: string): string => {
// For cases [image: IMAGE_NAME.EXTENSION]
const sealRegex = `\\[(image:\\s)(.*)\\]`;
return plain.replace(new RegExp(sealRegex), "[$2]");
};
export const cleanupHiddenCharacters = (s: string): string => { export const cleanupHiddenCharacters = (s: string): string => {
const removeSymbols = new RegExp(/[\u200B]+/g); const removeSymbols = new RegExp(/[\u200B]+/g);
return s.replace(removeSymbols, ""); return s.replace(removeSymbols, "");
......
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