From 381c33cfb54a4875dfcf789763b38c224bc802bb Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 9 May 2024 15:10:05 +0100 Subject: [PATCH] Adding support for buffers in a few places - this helps with BYTE type columns in SQL. --- packages/server/src/api/controllers/row/utils/basic.ts | 5 ++++- packages/server/src/integrations/utils/utils.ts | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/server/src/api/controllers/row/utils/basic.ts b/packages/server/src/api/controllers/row/utils/basic.ts index 6255e13c1c..0c2c786e18 100644 --- a/packages/server/src/api/controllers/row/utils/basic.ts +++ b/packages/server/src/api/controllers/row/utils/basic.ts @@ -73,12 +73,15 @@ export function basicProcessing({ // filter the row down to what is actually the row (not joined) for (let field of Object.values(table.schema)) { const fieldName = field.name - const value = extractFieldValue({ + let value = extractFieldValue({ row, tableName: table.name, fieldName, isLinked, }) + if (value instanceof Buffer) { + value = value.toString() + } // all responses include "select col as table.col" so that overlaps are handled if (value != null) { thisRow[fieldName] = value diff --git a/packages/server/src/integrations/utils/utils.ts b/packages/server/src/integrations/utils/utils.ts index aac3f5f74a..e2fba11a4e 100644 --- a/packages/server/src/integrations/utils/utils.ts +++ b/packages/server/src/integrations/utils/utils.ts @@ -192,6 +192,11 @@ export function generateRowIdField(keyProps: any[] = []) { if (!Array.isArray(keyProps)) { keyProps = [keyProps] } + for (let index in keyProps) { + if (keyProps[index] instanceof Buffer) { + keyProps[index] = keyProps[index].toString() + } + } // this conserves order and types // we have to swap the double quotes to single quotes for use in HBS statements // when using the literal helper the double quotes can break things