fix(inputFileComponent): handle case when fileTypes prop is undefined to prevent error when checking file type

The checkFileType function in the InputFileComponent component now handles the case when the fileTypes prop is undefined. This prevents an error from occurring when checking the file type of the selected file.
This commit is contained in:
anovazzi1 2023-11-30 16:17:35 -03:00
commit ab56d48002

View file

@ -28,6 +28,7 @@ export default function InputFileComponent({
}, [disabled, onChange]);
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;