From ed7e463001acbea5ec6b474924841ea988526155 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Tue, 8 Feb 2022 22:29:53 +0100 Subject: [PATCH] Composer: Fix duplicated documents when uploading in Firefox (#1705) --- src/components/middle/composer/DropArea.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/middle/composer/DropArea.tsx b/src/components/middle/composer/DropArea.tsx index 3ae1473d..4eb60ff4 100644 --- a/src/components/middle/composer/DropArea.tsx +++ b/src/components/middle/composer/DropArea.tsx @@ -43,17 +43,15 @@ const DropArea: FC = ({ 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]);