mirror of
https://github.com/immich-app/immich.git
synced 2025-01-27 22:22:45 +01:00
fix(web): upload on file paste (#11922)
This commit is contained in:
parent
3be1aaaaa4
commit
817f42aef7
1 changed files with 17 additions and 5 deletions
|
@ -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';
|
||||||
|
|
Loading…
Reference in a new issue