From d15efcc0f8553e18f6faa4a82dfa86b7a446fee5 Mon Sep 17 00:00:00 2001 From: Shivam Chouhan Date: Sat, 19 Oct 2024 14:56:58 +0530 Subject: [PATCH] Fixed - toast message when user cancels CSV upload operation on Bulk Upload page #479 --- src/views/BulkUpload.vue | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/views/BulkUpload.vue b/src/views/BulkUpload.vue index ee620309..97df57d2 100644 --- a/src/views/BulkUpload.vue +++ b/src/views/BulkUpload.vue @@ -211,6 +211,22 @@ async function parse(event) { const file = event.target.files[0]; try { if (file) { + const fileExtension = file.name.split('.')[1]; + // Added n file extension check + if(fileExtension !== 'csv'){ + console.log("Not a csv file.") + showToast(translate("Please upload a csv file only.")); + return; + } + + resetDefaults(); + console.log(uploadedFile.value.size); + if(uploadedFile.value != {}){ + console.log("There is already a file"); + // return; + }else{ + console.log("There is no file"); + } uploadedFile.value = file; fileName.value = file.name content.value = await parseCsv(uploadedFile.value);