This commit is contained in:
Benjamin Toby 2024-12-12 05:59:14 +01:00
parent 6f6759e74e
commit e250dfc105
3 changed files with 7 additions and 4 deletions

View File

@ -2,7 +2,6 @@
const sanitizeHtml = require("sanitize-html"); const sanitizeHtml = require("sanitize-html");
const sanitizeHtmlOptions = require("../html/sanitizeHtmlOptions"); const sanitizeHtmlOptions = require("../html/sanitizeHtmlOptions");
const updateDb = require("./updateDbEntry");
const updateDbEntry = require("./updateDbEntry"); const updateDbEntry = require("./updateDbEntry");
const _ = require("lodash"); const _ = require("lodash");
const DB_HANDLER = require("../../../utils/backend/global-db/DB_HANDLER"); const DB_HANDLER = require("../../../utils/backend/global-db/DB_HANDLER");
@ -160,7 +159,9 @@ async function addDbEntry({
console.log("DSQL: Encrypted value =>", value); console.log("DSQL: Encrypted value =>", value);
} }
if (targetFieldSchema?.richText) { const htmlRegex = /<[^>]+>/g;
if (targetFieldSchema?.richText || String(value).match(htmlRegex)) {
value = sanitizeHtml(value, sanitizeHtmlOptions); value = sanitizeHtml(value, sanitizeHtmlOptions);
} }

View File

@ -98,7 +98,9 @@ async function updateDbEntry({
if (value == null || value == undefined) continue; if (value == null || value == undefined) continue;
if (targetFieldSchema?.richText) { const htmlRegex = /<[^>]+>/g;
if (targetFieldSchema?.richText || String(value).match(htmlRegex)) {
value = sanitizeHtml(value, sanitizeHtmlOptions); value = sanitizeHtml(value, sanitizeHtmlOptions);
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@moduletrace/datasquirel", "name": "@moduletrace/datasquirel",
"version": "2.9.8", "version": "2.9.9",
"description": "Cloud-based SQL data management tool", "description": "Cloud-based SQL data management tool",
"main": "index.js", "main": "index.js",
"bin": { "bin": {