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:
parent
d26b6e36b2
commit
ab56d48002
1 changed files with 1 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue