fix: Use the basename for folder file uploads
This commit is contained in:
parent
195e3d1417
commit
83c7328470
1 changed files with 7 additions and 2 deletions
|
|
@ -271,15 +271,20 @@ export function KnowledgeDropdown() {
|
|||
|
||||
toast.info(`Processing ${filteredFiles.length} file(s)...`);
|
||||
|
||||
for (const file of filteredFiles) {
|
||||
for (const originalFile of filteredFiles) {
|
||||
try {
|
||||
// Create a new File object with just the basename (no folder path)
|
||||
// The webkitRelativePath property includes the folder name which causes issues
|
||||
const fileName = originalFile.name.split('/').pop() || originalFile.name;
|
||||
const file = new File([originalFile], fileName, { type: originalFile.type });
|
||||
|
||||
const checkData = await duplicateCheck(file);
|
||||
|
||||
if (!checkData.exists) {
|
||||
await uploadFileUtil(file, false);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Failed to upload ${file.name}:`, error);
|
||||
console.error(`Failed to upload ${originalFile.name}:`, error);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue