Skip to content

Commit

Permalink
fix: missed files while upload folder (close alist-org/alist#2404)
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Nov 20, 2022
1 parent 1422b8c commit b9ef4a7
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/pages/home/uploads/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,18 @@ export const traverseFileTree = async (entry: FileSystemEntry) => {
}, errorCallback)
} else if (entry.isDirectory) {
const dirReader = (entry as FileSystemDirectoryEntry).createReader()
dirReader.readEntries(async (entries) => {
for (let i = 0; i < entries.length; i++) {
await internalProcess(entries[i], path + entry.name + "/")
}
resolve({})
}, errorCallback)
const readEntries = () => {
dirReader.readEntries(async (entries) => {
if (entries.length === 0) {
resolve({})
}
for (let i = 0; i < entries.length; i++) {
await internalProcess(entries[i], path + entry.name + "/")
}
readEntries()
}, errorCallback)
}
readEntries()
}
})
await promise
Expand All @@ -43,4 +49,4 @@ export const File2Upload = (file: File): UploadFileProps => {
speed: 0,
status: "pending",
}
}
}

0 comments on commit b9ef4a7

Please sign in to comment.