From 86db14046ae992ad1e9a37cf44b5e4399728a2e5 Mon Sep 17 00:00:00 2001 From: Kaosiso Ezealigo Date: Mon, 2 Dec 2024 18:19:04 +0100 Subject: [PATCH] fix(frontend): fixed upload testset validation --- agenta-web/src/lib/helpers/fileManipulations.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/agenta-web/src/lib/helpers/fileManipulations.ts b/agenta-web/src/lib/helpers/fileManipulations.ts index e3b6890e92..b9d542f3fe 100644 --- a/agenta-web/src/lib/helpers/fileManipulations.ts +++ b/agenta-web/src/lib/helpers/fileManipulations.ts @@ -22,8 +22,13 @@ export const downloadCsv = (csvContent: string, filename: string): void => { export const isValidCSVFile = (file: File) => { return new Promise((res) => { Papa.parse(file, { + skipEmptyLines: true, complete: (results) => { - res(results.errors.length === 0) + if (results.data && results.data.length > 0) { + res(true) + } else { + res(false) + } }, error: () => { res(false)