This commit is contained in:
Benjamin Toby 2025-07-19 07:15:51 +01:00
parent 5a4d4448a5
commit 3cf76f5155
3 changed files with 11 additions and 30 deletions

View File

@ -23,7 +23,7 @@ function grabParsedValue({ value, tableSchema, encryptionKey, encryptionSalt, da
if (typeof newValue == "undefined")
return;
if (typeof newValue == "object" && !newValue)
newValue = "";
newValue = null;
const htmlRegex = /<[^>]+>/g;
if ((targetFieldSchema === null || targetFieldSchema === void 0 ? void 0 : targetFieldSchema.richText) || String(newValue).match(htmlRegex)) {
newValue = (0, sanitize_html_1.default)(newValue, sanitizeHtmlOptions_1.default);
@ -50,19 +50,9 @@ function grabParsedValue({ value, tableSchema, encryptionKey, encryptionSalt, da
newValue = "";
}
}
if (typeof newValue === "string" && newValue.match(/^null$/i)) {
newValue = {
toSqlString: function () {
return "NULL";
},
};
}
if (typeof newValue === "string" && !newValue.match(/./i)) {
newValue = {
toSqlString: function () {
return "NULL";
},
};
if (typeof newValue === "string" &&
(newValue.match(/^null$/i) || !newValue.match(/./i))) {
newValue = null;
}
return newValue;
}

View File

@ -34,7 +34,7 @@ export default function grabParsedValue({
: null;
if (typeof newValue == "undefined") return;
if (typeof newValue == "object" && !newValue) newValue = "";
if (typeof newValue == "object" && !newValue) newValue = null;
const htmlRegex = /<[^>]+>/g;
@ -73,20 +73,11 @@ export default function grabParsedValue({
}
}
if (typeof newValue === "string" && newValue.match(/^null$/i)) {
newValue = {
toSqlString: function () {
return "NULL";
},
};
}
if (typeof newValue === "string" && !newValue.match(/./i)) {
newValue = {
toSqlString: function () {
return "NULL";
},
};
if (
typeof newValue === "string" &&
(newValue.match(/^null$/i) || !newValue.match(/./i))
) {
newValue = null;
}
return newValue;

View File

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