-
Notifications
You must be signed in to change notification settings - Fork 27.9k
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
Sanity check file names before writing to disk #1579
Comments
One more update, although that's probably not too surprising: The file was saved on an NTFS partition. |
Sorry, one more: Code also allows me to save files with a trailing space or using reserved names like (tested by launching code.bat with the filename as a parameter, ie. nul, com1, com2, com3, com4, com5, com6, com7, com8, com9, lpt1, lpt2, lpt3, lpt4, lpt5, lpt6, lpt7, lpt8, lpt9, con, conIN$, conOUT$, prn, clock$ I'm sure there are more DOS devices that cannot be used as a filename under Windows but I can't remember all of them and I can't find a proper list right now either. Even though NTFS doesn't really care there are only very few programs that are able to use those files. So far the only "built-in" way I found is using powershell and prefixing the paths with \?\ but at least on Windows 7 not even the explorer or the command line use the unicode API which means that those file names prove to be problematic and should be avoided. |
Good reference: https://en.wikipedia.org/wiki/Filename |
New fix needs to be re-verified on Windows. |
I just manged to save a file with the filename "cd.." because I wanted to go to the upper folder and mistakenly typed the "cd" as well instead of just ".." in the file save dialog. The file was in fact created but Windows is not too fond of that name. The file is pretty much unusable outside of VSCode.
After investigating further it looks like trailing dots are not getting removed when saving a file. Other programs either remove all the dots or add an extra file extension. VSCode doesn't and typos prove to be quite problematic that way :)
The text was updated successfully, but these errors were encountered: