From e2b1551b8b5d879e32f4fb2f0da3a903668d1b26 Mon Sep 17 00:00:00 2001 From: Eric Lipe Date: Tue, 5 Sep 2023 11:22:12 -0600 Subject: [PATCH] - Updated regex --- tdrs-frontend/src/components/FileUpload/FileUpload.jsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tdrs-frontend/src/components/FileUpload/FileUpload.jsx b/tdrs-frontend/src/components/FileUpload/FileUpload.jsx index 2c8fb2093..35dc66cf1 100644 --- a/tdrs-frontend/src/components/FileUpload/FileUpload.jsx +++ b/tdrs-frontend/src/components/FileUpload/FileUpload.jsx @@ -94,11 +94,8 @@ function FileUpload({ section, setLocalAlertState }) { /* istanbul ignore next */ if (!evt.target.error) { // Validate file extension before proceeding - const re = /(\.txt|\.ms\d{2}|\.ts\d{2,3})/i - const filename = file.name - const n = filename.lastIndexOf('.') - const ext = filename.substring(n) - if (!re.exec(ext)) { + const re = /(\.txt|\.ms\d{2}|\.ts\d{2,3})$/i + if (!re.exec(file.name)) { // reject the file and create an error message createFileInputErrorState(input, dropTarget)