-
Notifications
You must be signed in to change notification settings - Fork 65
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
Allow files with no extensions #406
Comments
Extensions are not required. See https://fs.spec.whatwg.org/#valid-file-name - although that definition is quite poor and likely to change soon, so follow along on whatwg/fs#93 to see where this is probably heading The text you linked is just for the file picker options. Meaning you can't specify "only give me files that don't have an extension"... which seems like a niche use case and not something I'd expect platform picker APIs (which generally filter by MIME type) to support anyways Using |
The use-case is the file-picker. Currently it is only possible to allow files with file-endings or all files. But in our case a file has either a .xml ending or no ending. However, .png and .pdf should still not be allowed. Here is an example of the configuration on mdn: const pickerOpts = {
types: [
{
description: "Images",
accept: {
"image/*": [".png", ".gif", ".jpeg", ".jpg"],
},
},
],
excludeAcceptAllOption: true,
multiple: false,
}; An option would be to support an empty string for a given mime-type. The system file picker could then allow files without file endings while still disable those with the wrong file ending. const pickerOpts = {
types: [
{
description: "SEPA Payment Files",
accept: {
"text/xml": [".xml", ".pain.001", ""],
},
},
],
excludeAcceptAllOption: true,
multiple: false,
}; |
I looked into this out of curiosity, but this does not seem to be something the underlying platforms support anyways. For example on Mac, NSOpenPanel takes an allowedContentTypes array, which takes a UTType that doesn't appear to be able to express "files with no type". Things look similarly not possible on Windows I think |
Currently, the spec disallows file without an extensions.
There are use-cases where the type of a file is known and the (legacy) software that exported it did not use extensions.
The text was updated successfully, but these errors were encountered: