Skip to content

Commit

Permalink
@uppy/utils: fix drop of multiple files on Chromium browsers (#3998)
Browse files Browse the repository at this point in the history
Fixes: #3988
  • Loading branch information
aduh95 committed Aug 17, 2022
1 parent 03d0590 commit 8ed9872
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -41,10 +41,15 @@ async function* createPromiseToAddFileOrParseDirectory (entry) {
}

export default async function* getFilesFromDataTransfer (dataTransfer, logDropError) {
for (const item of dataTransfer.items) {
const entries = await Promise.all(Array.from(dataTransfer.items, async item => {
const lastResortFile = item.getAsFile() // Chromium bug, see https://github.com/transloadit/uppy/issues/3505.
const entry = await item.getAsFileSystemHandle?.()
?? getAsFileSystemHandleFromEntry(item.webkitGetAsEntry(), logDropError)

return { lastResortFile, entry }
}))

for (const { lastResortFile, entry } of entries) {
// :entry can be null when we drop the url e.g.
if (entry != null) {
try {
Expand Down

0 comments on commit 8ed9872

Please sign in to comment.