-
-
Notifications
You must be signed in to change notification settings - Fork 320
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
fix: gracefully handle null items #517
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Hey @yoyo837, any chance I could get a review on this? This is my first contribution so let me know if I am missing anything or if you need more information. Thanks! |
Could you add some test case for it? |
Codecov Report
@@ Coverage Diff @@
## master #517 +/- ##
==========================================
+ Coverage 84.92% 87.00% +2.08%
==========================================
Files 6 6
Lines 252 254 +2
Branches 63 62 -1
==========================================
+ Hits 214 221 +7
+ Misses 38 33 -5
... and 1 file with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@yoyo837 Added! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Per the DataTransferItem API, if
webkitGetAsEntry()
is called on something that isn't a file or folder, null is returned. Sometimes when dragging and dropping a file, extra string meta data seems to be associated with the event (examples, dragging and dropping an image blob from a different browser tab, or dragging a message from the Outlook desktop app).This causes an exception to be thrown, because the
_traverseFileTree
function assumes each item to be a validInternalDataTransferItem
. The end result is any valid file in the items array will not get uploaded after this exception occurs. If we can instead gracefully handle this case, valid directories will still get crawled and valid files will still get uploaded.fix #514