From 1f1786c2b342040e6fab00b9ed66f385224a1b24 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 5 Nov 2021 12:37:16 +0000 Subject: [PATCH] Fix issue saving a doc with a multi-options datatype that was not defined --- packages/server/src/api/controllers/row/utils.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/server/src/api/controllers/row/utils.js b/packages/server/src/api/controllers/row/utils.js index ca6c782713..6bbc6474ee 100644 --- a/packages/server/src/api/controllers/row/utils.js +++ b/packages/server/src/api/controllers/row/utils.js @@ -68,7 +68,11 @@ exports.validate = async ({ appId, tableId, row, table }) => { let res // Validate.js doesn't seem to handle array - if (table.schema[fieldName].type === FieldTypes.ARRAY) { + if ( + table.schema[fieldName].type === FieldTypes.ARRAY && + row[fieldName] && + row[fieldName].length + ) { row[fieldName].map(val => { if (!constraints.inclusion.includes(val)) { errors[fieldName] = "Field not in list"