From aeb3353dd4153991d31f4ed14b2454a708e44401 Mon Sep 17 00:00:00 2001 From: Aryan Bhendarkar Date: Wed, 1 Oct 2025 17:15:01 +0530 Subject: [PATCH] fix: restore flow action to strip HTML tags safely --- .../removeHtmlTags.js | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/Specialized Areas/Flow Actions/Remove HTML Tags from a String in a Flow/removeHtmlTags.js b/Specialized Areas/Flow Actions/Remove HTML Tags from a String in a Flow/removeHtmlTags.js index f5608cdb09..47f79b9120 100644 --- a/Specialized Areas/Flow Actions/Remove HTML Tags from a String in a Flow/removeHtmlTags.js +++ b/Specialized Areas/Flow Actions/Remove HTML Tags from a String in a Flow/removeHtmlTags.js @@ -1,4 +1,21 @@ -(function execute(inputs, outputs) { - var htmlString = inputs.htmlValue || ''; - outputs.plainString = htmlString.replace(/<[^>]+>/g, '').trim(); -})(inputs, outputs); +function removeHtmlTags(value) { + if (value === null || value === undefined) { + return ''; + } + + var stringValue = String(value); + var withoutTags = stringValue.replace(/<[^>]+>/g, ' '); + + return withoutTags.replace(/\s+/g, ' ').trim(); +} + +if (typeof module !== 'undefined') { + module.exports = removeHtmlTags; +} + +if (typeof inputs !== 'undefined' && typeof outputs !== 'undefined') { + (function execute(inputs, outputs) { + var htmlString = inputs.htmlValue || ''; + outputs.plainString = removeHtmlTags(htmlString); + })(inputs, outputs); +}