fix: Remove style tags from email content (#2515)

This commit is contained in:
Pranav Raj S
2021-06-26 11:50:40 +05:30
committed by GitHub
parent bed1979986
commit ac657e3bf9
3 changed files with 31 additions and 6 deletions

View File

@@ -76,6 +76,8 @@ import contentTypeMixin from 'shared/mixins/contentTypeMixin';
import BubbleActions from './bubble/Actions';
import { MESSAGE_TYPE, MESSAGE_STATUS } from 'shared/constants/messages';
import { generateBotMessageContent } from './helpers/botMessageContentHelper';
import { stripStyleCharacters } from './helpers/EmailContentParser';
export default {
components: {
BubbleActions,
@@ -116,12 +118,10 @@ export default {
} = this.contentAttributes;
if ((replyHTMLContent || fullHTMLContent) && this.isIncoming) {
let parsedContent = new DOMParser().parseFromString(
replyHTMLContent || fullHTMLContent || '',
'text/html'
);
if (!parsedContent.getElementsByTagName('parsererror').length) {
return parsedContent.body.innerHTML;
let contentToBeParsed = replyHTMLContent || fullHTMLContent || '';
const parsedContent = stripStyleCharacters(contentToBeParsed);
if (parsedContent) {
return parsedContent;
}
}
return (