1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2024-12-28 06:31: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:
Alex 2024-11-22 16:38:20 -06:00 committed by GitHub
parent 1c82804f63
commit 6d492985a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -96,13 +96,25 @@
});
};
const readEntriesAsync = (reader: FileSystemDirectoryReader) => {
return new Promise<FileSystemEntry[]>((resolve, reject) => {
reader.readEntries(resolve, reject);
});
};
const getContentsFromFileSystemDirectoryEntry = async (
fileSystemDirectoryEntry: FileSystemDirectoryEntry,
): Promise<FileSystemEntry[]> => {
return new Promise((resolve, reject) => {
const reader = fileSystemDirectoryEntry.createReader();
reader.readEntries(resolve, reject);
});
const reader = fileSystemDirectoryEntry.createReader();
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[]) => {