From b0e6d3e72c826ef0a7c6cc242e5761e90b3ef5b1 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 27 Jun 2024 17:55:09 +0100 Subject: [PATCH] Correctly handling overlapping column names. --- packages/server/src/sdk/app/rows/search/sqs.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/server/src/sdk/app/rows/search/sqs.ts b/packages/server/src/sdk/app/rows/search/sqs.ts index e33d41c99f..8c376f726e 100644 --- a/packages/server/src/sdk/app/rows/search/sqs.ts +++ b/packages/server/src/sdk/app/rows/search/sqs.ts @@ -99,10 +99,15 @@ function cleanupFilters( key => (userColumnMap[key] = mapToUserColumn(key)) ) ) + + // sort longest first, don't find substrings + const userColumnList = Object.keys(userColumnMap).sort( + (a, b) => b.length - a.length + ) // update the keys of filters to manage user columns for (let filter of Object.values(filters)) { for (let key of Object.keys(filter)) { - const found = Object.keys(userColumnMap).find(possibleColumn => + const found = userColumnList.find(possibleColumn => key.endsWith(possibleColumn) ) if (found) {