From 6028fc4384c3f1202f0b9c5164fd4f58aba20eff Mon Sep 17 00:00:00 2001 From: Jordan Frazier <122494242+jordanrfrazier@users.noreply.github.com> Date: Thu, 27 Mar 2025 13:35:13 -0700 Subject: [PATCH] fix: valid file type check (#7152) * Fix valid file type check * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- .../components/inputFileComponent/index.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/frontend/src/components/core/parameterRenderComponent/components/inputFileComponent/index.tsx b/src/frontend/src/components/core/parameterRenderComponent/components/inputFileComponent/index.tsx index 689e43641..c6dbb1012 100644 --- a/src/frontend/src/components/core/parameterRenderComponent/components/inputFileComponent/index.tsx +++ b/src/frontend/src/components/core/parameterRenderComponent/components/inputFileComponent/index.tsx @@ -44,12 +44,12 @@ export default function InputFileComponent({ function checkFileType(fileName: string): boolean { if (fileTypes === undefined) return true; - for (let index = 0; index < fileTypes.length; index++) { - if (fileName.endsWith(fileTypes[index])) { - return true; - } - } - return false; + + // Extract the file extension + const fileExtension = fileName.split(".").pop(); + + // Check if the extracted extension is in the list of accepted file types + return fileTypes.includes(fileExtension || ""); } const { mutateAsync, isPending } = usePostUploadFile();