-
Notifications
You must be signed in to change notification settings - Fork 57
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
Limit allowed "accepted" extensions in File System Access API file pickers. #580
Comments
Should these restrictions be aligned with |
I don't see any reason why we couldn't align these restrictions, but it also matters less for |
@kenchris and I looked at this today. First of all, neither of us think we have ever seen a Otherwise, this looks like a sensible change. |
I think that restriction to ASCII + "." makes a lot of sense - thought you can actually use emoji and control chars and the like in file extensions on Windows Does any OS actually associate .c++ with an IDE? I have never in my life as a C++ developer seen ".c++" extension and maybe we can avoid whitelisting "+" |
There is of course also ".c--": Maybe we should just add "+", "-" and "#". @cynthia found another example of # used in the wild |
And "$" and "!" :-) Luckily I don't find anything else weird here: https://en.wikipedia.org/wiki/List_of_filename_extensions_(A%E2%80%93E) (and other sections) Almost forgot that ~ is also used in Linux for temporary files and also seen elsewhere: So ["+", "-", "#", "$", "!", "~"] - I am fine with adding those, but just adding "+" and not the others seems strange |
Hi @mkruisselbrink any feedback you can share based on Ken's comments above? |
Sorry for the slow reply. The current list of characters is indeed fairly arbitrary. I think I originally did include most of what you're asking about (going of the wikipedia list), but got some push back that without clear use cases it was better to be as minimal as possible (because who knows what characters might have special meaning on particular file systems/operating systems). I agree that + is a bit of an odd one out in that regard. I believe I mostly went by what was in the freedesktop.org shared-mime-info database, which does include .c++, but none of the other characters (so yes, most linux installations will treat .c++ files as the same mime type as .cpp and .cc, and thus have the same applications associated with them). I'd be fine with adding the rest, although so far nobody has asked for them yet. |
Ok sounds good, we are good to close this then. Thanks for consulting the TAG. |
HIQaH! QaH! TAG!
I'm requesting a TAG review of a small tweak to the File System Access API.
Initially the File System Access API (previously known as Native File System API) had no limitations on what strings were allowed to be used as accepted file extensions in the showOpenFilePicker and showSaveFilePicker methods.
Since the file picker (on most platforms) appends these extensions to the filename the user enters, this can result in filenames with characters we don’t want to allow/that are otherwise problematic. In particular we don't want to allow control characters or whitespace in suffixes, or filenames that end in a '.'. As such we add restrictions on what characters are allowed in accepts file extensions/suffixes, as well as limiting their length to 16.
Limiting extensions to only contain alphanumeric characters, + or . still allows all
extensions in the shared-mime-info database as well as nearly all extensions in Wikipedia's List of filename extensions.
Further details:
You should also know that...
[please tell us anything you think is relevant to this review]
We'd prefer the TAG provide feedback as (please delete all but the desired option):
💬 leave review feedback as a comment in this issue and @-notify @mkruisselbrink
The text was updated successfully, but these errors were encountered: