From 286f6e52f0775dbe8d0921461a44987fd2ee77f1 Mon Sep 17 00:00:00 2001 From: Ashish Jain Date: Thu, 24 Feb 2022 19:17:37 +0100 Subject: [PATCH] Adding sanitization to input fields for Pie chart --- src/diagrams/pie/pieDb.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/diagrams/pie/pieDb.js b/src/diagrams/pie/pieDb.js index 25ebb4efb..47592b211 100644 --- a/src/diagrams/pie/pieDb.js +++ b/src/diagrams/pie/pieDb.js @@ -1,6 +1,8 @@ import { log } from '../../logger'; import mermaidAPI from '../../mermaidAPI'; import * as configApi from '../../config'; +import common from '../common/common'; +const sanitizeText = (txt) => common.sanitizeText(txt, configApi.getConfig()); let sections = {}; let title = ''; @@ -12,6 +14,7 @@ export const parseDirective = function (statement, context, type) { }; const addSection = function (id, value) { + id = common.sanitizeText(id, configApi.getConfig()); if (typeof sections[id] === 'undefined') { sections[id] = value; log.debug('Added new section :', id); @@ -20,7 +23,7 @@ const addSection = function (id, value) { const getSections = () => sections; const setTitle = function (txt) { - title = txt; + title = common.sanitizeText(txt, configApi.getConfig()); }; const setShowData = function (toggle) { @@ -36,7 +39,7 @@ const getTitle = function () { }; const setAccDescription = function (txt) { - description = txt; + description = common.sanitizeText(txt, configApi.getConfig()); }; const getAccDescription = function () {