From 282cb421856122b9956e3b08577795a1bb5db9fa Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Mon, 21 Feb 2022 14:07:37 +0300 Subject: [PATCH] Update validate.js --- scripts/db/validate.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/db/validate.js b/scripts/db/validate.js index a3683080..a7b61459 100644 --- a/scripts/db/validate.js +++ b/scripts/db/validate.js @@ -34,20 +34,24 @@ async function main() { process.exit(1) } - const data = await csv.fromString(csvString).catch(err => { - logger.error(chalk.red(`\n${err.message} (${filepath})`)) - process.exit(1) - }) - const filename = file.getFilename(filepath) - if (!schemes[filename]) { logger.error(chalk.red(`\nError: "${filename}" scheme is missing`)) process.exit(1) } + const data = await csv.fromString(csvString).catch(err => { + logger.error(chalk.red(`\n${err.message} (${filepath})`)) + process.exit(1) + }) + let fileErrors = [] if (filename === 'channels') { + if (/\"/.test(csvString)) { + logger.error(chalk.red(`\nError: \" character is not allowed (${filepath})`)) + process.exit(1) + } + fileErrors = fileErrors.concat(findDuplicatesById(data)) }