From 4efec72b4db7269692f79a5975d22ddd516d7c77 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 19 Mar 2024 16:11:26 +0000 Subject: [PATCH] Fixing an issue uncovered by tests, MS-SQL and MariaDB when columns are aliased don't always return an array, they may return a stringified version. Making the reference processor more hardy against this. --- .../utilities/rowProcessor/bbReferenceProcessor.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/server/src/utilities/rowProcessor/bbReferenceProcessor.ts b/packages/server/src/utilities/rowProcessor/bbReferenceProcessor.ts index c7b8998bad..a51ac32da7 100644 --- a/packages/server/src/utilities/rowProcessor/bbReferenceProcessor.ts +++ b/packages/server/src/utilities/rowProcessor/bbReferenceProcessor.ts @@ -68,8 +68,16 @@ export async function processOutputBBReferences( return value || undefined } - const ids = - typeof value === "string" ? value.split(",").filter(id => !!id) : value + let ids: string[] = [] + if (typeof value === "string") { + try { + ids = JSON.parse(value) + } catch (err) { + ids = value.split(",").filter(id => !!id) + } + } else if (Array.isArray(value)) { + ids = value + } switch (subtype) { case FieldSubtype.USER: