1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-27 22:22:45 +01:00

fix(web): upload on file paste ()

This commit is contained in:
Jason Rasmussen 2024-08-20 09:25:26 -04:00 committed by GitHub
parent 3be1aaaaa4
commit 817f42aef7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -40,11 +40,23 @@
return handleFiles(dataTransfer.files); return handleFiles(dataTransfer.files);
} }
const transferEntries = Array.from(dataTransfer.items) const entries: FileSystemEntry[] = [];
.map((i: DataTransferItem) => i.webkitGetAsEntry()) const files: File[] = [];
.filter((i) => i !== null); for (const item of dataTransfer.items) {
const files = await getAllFilesFromTransferEntries(transferEntries); const entry = item.webkitGetAsEntry();
return handleFiles(files); if (entry) {
entries.push(entry);
continue;
}
const file = item.getAsFile();
if (file) {
files.push(file);
}
}
const directoryFiles = await getAllFilesFromTransferEntries(entries);
return handleFiles([...files, ...directoryFiles]);
}; };
const browserSupportsDirectoryUpload = () => typeof DataTransferItem.prototype.webkitGetAsEntry === 'function'; const browserSupportsDirectoryUpload = () => typeof DataTransferItem.prototype.webkitGetAsEntry === 'function';