fix #1964 – error when selecting no files to import after previously selecting files

This commit is contained in:
Tom Moor 2021-03-16 22:09:19 -07:00
parent eff56b758c
commit a427d77076

View File

@ -85,6 +85,12 @@ function CollectionMenu({
async (ev: SyntheticEvent<>) => {
const files = getDataTransferFiles(ev);
// Because this is the onChange handler it's possible for the change to be
// from previously selecting a file to not selecting a file aka empty
if (!files.length) {
return;
}
try {
const file = files[0];
const document = await documents.import(file, null, collection.id, {