[BUG] File picker not showing on Chrome/Edge when extension with underscore exists
Describe the bug In Google Chrome and Microsoft Edge it's currently not possible to show the file picker if accept has any file extension containing an underscore (e.g. '.zip_1'). It still works in Mozilla Firefox.
It's showing TypeError: Failed to execute 'showOpenFilePicker' on 'Window': Extension '.zip_1' contains invalid characters. in the console output if I click on the dropzone.
To Reproduce Here is a small code sample:
import {useDropzone} from 'react-dropzone'
export default function Home() {
const { getRootProps, getInputProps } = useDropzone({
accept: { 'application/zip': ['.zip', '.zip_1'] }
})
return (
<>
<div {...getRootProps()} id="upload-file" style={{width: '200px', height: '200px'}}>
<input {...getInputProps()} />
</div>
</>
)
}
Expected behavior Should show the file picker dialog
Screenshots

Desktop:
- OS: Windows 11
- Browser Chrome; Edge
- Version 108.0.5359.95 (Official Build) (64-bit); 107.0.1418.56 (Official build) (64-bit)
We're having the exact same issue. We did find a temporary workaround...if you don't specify the MIME type, it seems to work fine:

@joebochill - does it still show that option in the file picker? For me it filters that option out, and warns in the console.
I've raised this bug on Chromium:
https://bugs.chromium.org/p/chromium/issues/detail?id=1420912
@bensewell yes, I do get a warning in the console, but I am able to select the file from the picker window (in Chrome, that's all I checked).
On a mac, the file picker window defaults to "JPEG Images", so I have to toggle the dropdown to allow "All Files", but then I am able to select the files with the underscore in the extension:

I apologize in advance for commenting in an old ticket, but does anyone know under what circumstances this bug appears? We're trying to work around it, but cannot reproduce it locally and it's clearly not 100% of users... our testing shows only a relatively small % of users seeing this issue (we also have users uploading CAD files in x_t and x_b format).