-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
[BUG] v0.4.0 returning empty value as file path in electron #52
Comments
@barbalex thanks for reporting this. Interesting. These are the changes b/t v0.2 and v0.4. The major changes are around supporting the File System Access API. There's no changes in how the path gets read and set. So do you think it's possible electron supports the API and there's something about getting the files with no path? This would happen if you use click to select instead of drag 'n' drop, so when does it happen? Btw, you can disable the fs access API by using |
I tried again with v12.0.0:
|
Ok, thanks. Yes, so it's probably the FS access API that's probably not giving the path. I wonder if this has something to do with permissions 🤔 Could you quickly try this: getFile()
async function getFile() {
// open file picker
const [fileHandle] = await window.showOpenFilePicker();
const canRead = verifyPermission(fileHandle);
if (canRead) {
const fileData = await fileHandle.getFile();
console.log(fileData);
} else {
console.warn('no permissions to read file')
}
}
async function verifyPermission(fileHandle, withWrite) {
const opts = {};
// Check if we already have permission, if so, return true.
if (await fileHandle.queryPermission(opts) === 'granted') {
return true;
}
// Request permission to the file, if the user grants permission, return true.
if (await fileHandle.requestPermission(opts) === 'granted') {
return true;
}
// The user did not grant permission, return false.
return false;
} Try removing the |
I am seeing same issue on latest 0.6.0 version. For now going ahead with |
v14. Win 11. Electron. const { getRootProps, getInputProps, isDragActive, isDragReject } = useDropzone({ |
I'm going to close this as I believe that the issue was due to the new file access API usage. We've made that disabled by default in react-dropzone now until it becomes available in the baseline browsers. If the issue persists, please create a new issue. |
Describe the bug
In my project I have updated react-dropzone from v11.5.1 to v12.0.0.
Since then the path key of the file returned by react-dropzone is empty:
I once had similar issues. So I checked the version of file-selector used using
yarn why file-selector
. It returns:I have repeatedly up/downgraded react-dropzone versions and this issue consistently occurs on v12.0.0/0.4.0.
I tried installing react-dropzone v12.0.0 while enforcing file-selector v0.2.4 using yarn resolutions. That did not work as no file was returned from react-dropzone (also no error occured). So it seems I have to stay on react-dropzone v11.5.1 for now.
To Reproduce
I would have to build a minimal electron app to demonstrate this.
Expected behavior
The full path should be returned as it did in previous versions.
Desktop:
The text was updated successfully, but these errors were encountered: