useFilePicker
useFilePicker copied to clipboard
Linux/Gnome: useFilePicker silently ignores files from a ssh mounted volume
My component uses useFilePicker which works nicely with files in local filesystem (Downloads folder).
But, when I try selecting a file from a ssh mounted filesystem it is silently ignored, i.e. no callbacks (onFilesSelected, onFilesRejected, onFilesSuccessfullySelected) nor any errors.
So, my issue is how do detect that the file selection failed?
Code snippet:
const { openFilePicker, loading, errors } = useFilePicker({
accept: '.json',
multiple: false,
readFilesContent: true,
onFilesSelected: ({ plainFiles, filesContent, errors }) => {
// this callback is always called, even if there are errors
console.log('onFilesSelected', plainFiles, filesContent, errors);
},
onFilesRejected: ({ errors }) => {
enqueueSnackbar('File selection failed!', {variant: "success"});
console.log('File selection failed ', errors);
},
onFilesSuccessfullySelected: ({ plainFiles, filesContent }) => {
const data = filesContent[0];
upload(data.name, data.content);
},
onClear: () => {
// this callback is called when the selection is cleared
console.log('onClear');
},
});
console.log('DEBUG: ', errors);
Hi @frafall, I'm afraid your issue is browser related rather than caused by our package because we're only relying on browser APIs. If none of our callback functions are called, we cannot do anything about it. There has to be a bug on the browser side. Please check other libraries for file picking and see if ssh mounted file system works for them, I'd assume it won't work either.