Composer: Fix duplicated documents when uploading in Firefox (#1705)

This commit is contained in:
Alexander Zinchuk 2022-02-08 22:29:53 +01:00
parent 43704e92aa
commit ed7e463001

View File

@ -43,17 +43,15 @@ const DropArea: FC<OwnProps> = ({
const { dataTransfer: dt } = e;
let files: File[] = [];
if (dt.items && dt.items.length > 0) {
if (dt.files && dt.files.length > 0 && (!dt.items || !dt.items.length)) {
files = files.concat(Array.from(dt.files));
} else if (dt.items && dt.items.length > 0) {
const folderFiles = await getFilesFromDataTransferItems(dt.items);
if (folderFiles.length) {
files = files.concat(folderFiles);
}
}
if (dt.files && dt.files.length > 0) {
files = files.concat(Array.from(dt.files));
}
onHide();
onFileSelect(files, false);
}, [onFileSelect, onHide]);