react-dropzone / react-dropzone

Simple HTML5 drag-drop zone with React.js.
https://react-dropzone.js.org/
MIT License
10.55k stars 785 forks source link

[BUG] File path not available on Electron if clicking to select files #1249

Open JuanIrache opened 1 year ago

JuanIrache commented 1 year ago

Describe the bug Dragging files into the Electron app provides the absolute file path, clicking to select the files with a dialog does not

To Reproduce Steps to reproduce the behavior:

  1. Clone minimal example https://github.com/JuanIrache/react-dropzone-electron-path-debug
  2. npm install
  3. npm run dev
  4. drag a file and see how the path prints correctly
  5. click to select a file and see how it does not

Expected behavior The file path can be read

Desktop:

Additional context This was working on react-dropzone@11, breaks on @12 and newer

JuanIrache commented 1 year ago

useFsAccessApi: false fixes this

harmonikas996 commented 1 year ago

@JuanIrache you're THE legend! Thanks a bunch!

kolyasya commented 9 months ago

@JuanIrache thanks! Fixed my issue with the missing file path in Electron app when using react-dropzone.

useDropzone({ onDrop, useFsAccessApi: false })

steveoh commented 3 weeks ago

This fixed an issue for me at one point but updating libraries today has this happening again.

rolandjitsu commented 2 weeks ago

@steveoh what version are you on now? Note that we've made the file access API disabled by default now.

steveoh commented 2 weeks ago

Newest version. Electron made a change that the prerender has to provide the location with a new webutils api and the renderer cannot access it directly.

rolandjitsu commented 2 weeks ago

Newest version. Electron made a change that the prerender has to provide the location with a new webutils api and the renderer cannot access it directly.

Is this something we need to fix/handle on our end?

steveoh commented 2 weeks ago

Not in my opinion.