From db48a486e5b7f4da4e2081b8c551d7dfc0cf5a81 Mon Sep 17 00:00:00 2001 From: advplyr Date: Tue, 3 May 2022 17:41:49 -0500 Subject: [PATCH] Fix:Drag and drop upload limits to 100 items per folder #560 --- client/mixins/uploadHelpers.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/client/mixins/uploadHelpers.js b/client/mixins/uploadHelpers.js index b2a98fc7..cc4b1997 100644 --- a/client/mixins/uploadHelpers.js +++ b/client/mixins/uploadHelpers.js @@ -112,11 +112,22 @@ export default { items: [] }) var newtreemap = currtreemap.items[currtreemap.items.length - 1] - dirReader.readEntries((entries) => { - let entriesPromises = [] - for (let entr of entries) entriesPromises.push(traverseFileTreePromise(entr, newtreemap)) - resolve(Promise.all(entriesPromises)) - }) + + let entriesPromises = [] + // readEntries returns 100 items max, continue calling readEntries until empty + function readEntries() { + dirReader.readEntries((entries) => { + if (entries.length > 0) { + for (let entr of entries) { + entriesPromises.push(traverseFileTreePromise(entr, newtreemap)) + } + readEntries() + } else { + resolve(Promise.all(entriesPromises)) + } + }) + } + readEntries() } }) }