From e53f7a1d286c2b5568fbfefa06820f0cd2798a32 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Tue, 13 Sep 2022 10:55:38 +0100 Subject: [PATCH] Case insensitive table fetch --- packages/server/src/api/controllers/datasource.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/server/src/api/controllers/datasource.js b/packages/server/src/api/controllers/datasource.js index 75fd1db02a..f7784d31d6 100644 --- a/packages/server/src/api/controllers/datasource.js +++ b/packages/server/src/api/controllers/datasource.js @@ -58,7 +58,9 @@ exports.buildSchemaFromDb = async function (ctx) { datasource.entities = {} } for (let key in tables) { - if (tablesFilter.includes(key)) { + if ( + tablesFilter.some(filter => filter.toLowerCase() === key.toLowerCase()) + ) { datasource.entities[key] = tables[key] } } @@ -237,7 +239,7 @@ const buildSchemaHelper = async datasource => { await connector.buildSchema(datasource._id, datasource.entities) // make sure they all have a display name selected - for (let entity of Object.values(datasource.entities)) { + for (let entity of Object.values(datasource.entities ?? {})) { if (entity.primaryDisplay) { continue }