This commit is contained in:
Manav Rathi 2024-04-19 16:01:05 +05:30
parent de783b6158
commit bf3d04fc12
No known key found for this signature in database
2 changed files with 8 additions and 4 deletions

View file

@ -436,7 +436,7 @@ export default function Uploader(props: Props) {
const collections: Collection[] = [];
let collectionNameToFilesMap = new Map<
string,
(File | ElectronFile)[]
File[] | ElectronFile[] | string[]
>();
if (strategy == "root") {
collectionNameToFilesMap.set(

View file

@ -176,11 +176,15 @@ export function getImportSuggestion(
// b => [e,f,g],
// c => [h, i]]
export function groupFilesBasedOnParentFolder(
toUploadFiles: File[] | ElectronFile[],
toUploadFiles: File[] | ElectronFile[] | string[],
) {
const collectionNameToFilesMap = new Map<string, (File | ElectronFile)[]>();
const collectionNameToFilesMap = new Map<
string,
File[] | ElectronFile[] | string[]
>();
for (const file of toUploadFiles) {
const filePath = file["path"] as string;
const filePath =
typeof file == "string" ? file : (file["path"] as string);
let folderPath = filePath.substring(0, filePath.lastIndexOf("/"));
// If the parent folder of a file is "metadata"