Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@uppy/utils: fix drop of multiple files on Chromium browsers #3998

Merged
merged 1 commit into from Aug 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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