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>
This commit is contained in:
parent
6557d3f860
commit
6028fc4384
1 changed files with 6 additions and 6 deletions
|
|
@ -44,12 +44,12 @@ export default function InputFileComponent({
|
||||||
|
|
||||||
function checkFileType(fileName: string): boolean {
|
function checkFileType(fileName: string): boolean {
|
||||||
if (fileTypes === undefined) return true;
|
if (fileTypes === undefined) return true;
|
||||||
for (let index = 0; index < fileTypes.length; index++) {
|
|
||||||
if (fileName.endsWith(fileTypes[index])) {
|
// Extract the file extension
|
||||||
return true;
|
const fileExtension = fileName.split(".").pop();
|
||||||
}
|
|
||||||
}
|
// Check if the extracted extension is in the list of accepted file types
|
||||||
return false;
|
return fileTypes.includes(fileExtension || "");
|
||||||
}
|
}
|
||||||
|
|
||||||
const { mutateAsync, isPending } = usePostUploadFile();
|
const { mutateAsync, isPending } = usePostUploadFile();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue