diff options
Diffstat (limited to 'server/sonar-web/src/main/js/helpers/code-difference.ts')
-rw-r--r-- | server/sonar-web/src/main/js/helpers/code-difference.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/server/sonar-web/src/main/js/helpers/code-difference.ts b/server/sonar-web/src/main/js/helpers/code-difference.ts index 2c07ef2679f..7fcdadd0d43 100644 --- a/server/sonar-web/src/main/js/helpers/code-difference.ts +++ b/server/sonar-web/src/main/js/helpers/code-difference.ts @@ -17,9 +17,10 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + import { diffLines } from 'diff'; import { groupBy, keyBy } from 'lodash'; -import { sanitizeString } from './sanitize'; +import { sanitizeHTMLNoSVGNoMathML } from './sanitize'; const NUMBER_OF_EXAMPLES = 2; @@ -71,7 +72,8 @@ function differentiateCode(compliant: string, nonCompliant: string) { let compliantCode = ''; hunks.forEach((hunk) => { - const value = sanitizeString(hunk.value); + const value = sanitizeHTMLNoSVGNoMathML(hunk.value); + if (!hunk.added && !hunk.removed) { nonCompliantCode += `<div>${value}</div>`; compliantCode += `<div>${value}</div>`; |