From e33aaff312bd63536d211a02056115845be0629d Mon Sep 17 00:00:00 2001 From: melohagan <101575380+melohagan@users.noreply.github.com> Date: Thu, 9 Feb 2023 11:46:41 +0000 Subject: [PATCH] Replace ts-ignore with 400 if needed (#9621) --- packages/server/src/api/controllers/row/external.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/server/src/api/controllers/row/external.ts b/packages/server/src/api/controllers/row/external.ts index 65fcbfbc41..b3f867d207 100644 --- a/packages/server/src/api/controllers/row/external.ts +++ b/packages/server/src/api/controllers/row/external.ts @@ -181,7 +181,7 @@ export async function validate(ctx: BBContext) { } export async function exportRows(ctx: BBContext) { - const { datasourceId } = breakExternalTableId(ctx.params.tableId) + const { datasourceId, tableName } = breakExternalTableId(ctx.params.tableId) const format = ctx.query.format const { columns } = ctx.request.body const datasource = await sdk.datasources.get(datasourceId!) @@ -217,7 +217,9 @@ export async function exportRows(ctx: BBContext) { rows = result.rows } - // @ts-ignore + if (!tableName) { + ctx.throw(400, "Could not find table name.") + } let schema = datasource.entities[tableName].schema let exportRows = cleanExportRows(rows, schema, format, columns)