Manav Rathi 1 anno fa
parent
commit
bf3d04fc12

+ 1 - 1
web/apps/photos/src/components/Upload/Uploader.tsx

@@ -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(

+ 7 - 3
web/apps/photos/src/utils/upload/index.ts

@@ -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"