From d068ec6713e233f3cd1f8b53a7150c122adb3a24 Mon Sep 17 00:00:00 2001 From: gladiator-1 <102553449+gladiator-1@users.noreply.github.com> Date: Wed, 30 Mar 2022 09:57:53 +0200 Subject: [PATCH] Update index.js --- src/libs/SelectionScraper/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libs/SelectionScraper/index.js b/src/libs/SelectionScraper/index.js index 07fdb2ca490c..7ad31948a2a5 100644 --- a/src/libs/SelectionScraper/index.js +++ b/src/libs/SelectionScraper/index.js @@ -1,8 +1,9 @@ import render from 'dom-serializer'; import ExpensiMark from 'expensify-common/lib/ExpensiMark'; -import {parseDocument} from 'htmlparser2'; -import {Element} from 'domhandler'; +import { parseDocument } from 'htmlparser2'; +import { Element } from 'domhandler'; import _ from 'underscore'; +import Str from 'expensify-common/lib/str'; const elementsWillBeSkipped = ['html', 'body']; const tagAttribute = 'data-testid'; @@ -88,6 +89,11 @@ const replaceNodes = (dom) => { let domChildren; const domAttribs = {}; + //Encoding HTML chars '< >' in the text, because any HTML will be removed in stripHTML method. + if (dom.type == "text") { + dom.data = Str.htmlEncode(dom.data) + } + // We are skipping elements which has html and body in data-testid, since ExpensiMark can't parse it. Also this data // has no meaning for us. if (dom.attribs && dom.attribs[tagAttribute]) {