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

workaround chrome crash #4310

Merged
merged 2 commits into from
Feb 15, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@ async function* createPromiseToAddFileOrParseDirectory (entry, relativePath, las
export default async function* getFilesFromDataTransfer (dataTransfer, logDropError) {
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)
let entry
// IMPORTANT: Need to check isSecureContext *first* or else Chrome will crash when running in HTTP:
// https://github.com/transloadit/uppy/issues/4133
if (window.isSecureContext && item.getAsFileSystemHandle != null) entry = await item.getAsFileSystemHandle()
// fallback
entry ??= getAsFileSystemHandleFromEntry(item.webkitGetAsEntry(), logDropError)

return { lastResortFile, entry }
}))
Expand Down