mirror of
https://github.com/langflow-ai/langflow.git
synced 2026-07-25 15:17:26 +08:00
fix: added check to upload .md files correctly (#8017)
Added check to upload file type if file.type does not exist
This commit is contained in:
@ -38,12 +38,10 @@ const useUploadFile = ({
|
||||
for (const file of filesToUpload) {
|
||||
validateFileSize(file);
|
||||
// Check if file extension is allowed
|
||||
const fileExtension = file.type
|
||||
? file.name.split(".").pop()?.toLowerCase()
|
||||
: null;
|
||||
if (types && (!fileExtension || !types.includes(fileExtension))) {
|
||||
const fileExtension = file.name.split(".").pop()?.toLowerCase();
|
||||
if (!fileExtension || (types && !types.includes(fileExtension))) {
|
||||
throw new Error(
|
||||
`File type not allowed. Allowed types: ${types.join(", ")}`,
|
||||
`File type ${fileExtension} not allowed. Allowed types: ${types?.join(", ")}`,
|
||||
);
|
||||
}
|
||||
if (!fileExtension) {
|
||||
|
||||
Reference in New Issue
Block a user