51722 (2) [Avatar] Offline
#1
In section 6.4.2, the code sets up a "getDraggedFile". This function errors when used in Listing 6.19 because "files" is an empty list, but you can access the file's type via "items". I'd suggest using something like the following:

const getDraggedFile = (event) => event.dataTransfer.items[0];

const getDroppedFile = (event) => event.dataTransfer.files[0];


Then use the appropriate function in the listings that follow.
Steve Kinney (33) [Avatar] Offline
#2
Hey! Thanks!

So, this is a known bug that popped up in Electron 1.7+. That chapter was written prior to that. Generally speaking,
files
should work, but the bug is actually in Chromium right now.
items
works some of the time, but not consistently in my testing. I am actively working to figure this out.

Issue on Github: https://github.com/electron/electron/issues/9840