mirror of
https://github.com/immich-app/immich.git
synced 2024-12-29 15:11:58 +00:00
fix(web): cannot upload folder with more than 100 files (#14284)
* fix: web cannot upload folder with more than 100 files * recursively call the function * async/do/while
This commit is contained in:
parent
1c82804f63
commit
6d492985a2
1 changed files with 16 additions and 4 deletions
|
@ -96,13 +96,25 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const readEntriesAsync = (reader: FileSystemDirectoryReader) => {
|
||||||
|
return new Promise<FileSystemEntry[]>((resolve, reject) => {
|
||||||
|
reader.readEntries(resolve, reject);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const getContentsFromFileSystemDirectoryEntry = async (
|
const getContentsFromFileSystemDirectoryEntry = async (
|
||||||
fileSystemDirectoryEntry: FileSystemDirectoryEntry,
|
fileSystemDirectoryEntry: FileSystemDirectoryEntry,
|
||||||
): Promise<FileSystemEntry[]> => {
|
): Promise<FileSystemEntry[]> => {
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
const reader = fileSystemDirectoryEntry.createReader();
|
const reader = fileSystemDirectoryEntry.createReader();
|
||||||
reader.readEntries(resolve, reject);
|
const files: FileSystemEntry[] = [];
|
||||||
});
|
let entries: FileSystemEntry[];
|
||||||
|
|
||||||
|
do {
|
||||||
|
entries = await readEntriesAsync(reader);
|
||||||
|
files.push(...entries);
|
||||||
|
} while (entries.length > 0);
|
||||||
|
|
||||||
|
return files;
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleFiles = async (files?: FileList | File[]) => {
|
const handleFiles = async (files?: FileList | File[]) => {
|
||||||
|
|
Loading…
Reference in a new issue