From 6416d7f1970babe54161f04bb8d6cbd37acbc58d Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 28 May 2021 12:04:15 +0100 Subject: [PATCH] Making sure certain fields aren't cleansed. --- packages/server/src/utilities/rowProcessor.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/server/src/utilities/rowProcessor.js b/packages/server/src/utilities/rowProcessor.js index ffcbf48d25..c93cc687a7 100644 --- a/packages/server/src/utilities/rowProcessor.js +++ b/packages/server/src/utilities/rowProcessor.js @@ -169,11 +169,15 @@ exports.inputProcessing = (user = {}, table, row) => { let clonedRow = cloneDeep(row) // need to copy the table so it can be differenced on way out const copiedTable = cloneDeep(table) + const dontCleanseKeys = ["type", "_id", "_rev", "tableId"] for (let [key, value] of Object.entries(clonedRow)) { const field = table.schema[key] // cleanse fields that aren't in the schema if (!field) { - delete clonedRow[key] + if (copiedTable.indexOf(key) === -1) { + delete clonedRow[key] + } + continue } clonedRow[key] = exports.coerce(value, field.type) }