Skip to content
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

Closed
DerTolleEmil opened this issue Dec 22, 2015 · 4 comments
Closed

Sanity check file names before writing to disk #1579

DerTolleEmil opened this issue Dec 22, 2015 · 4 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug file-explorer Explorer widget issues verified Verification succeeded
Milestone

Comments

@DerTolleEmil
Copy link

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 :)

@bpasero bpasero added bug Issue identified by VS Code Team member as probable bug file-explorer Explorer widget issues labels Dec 23, 2015
@bpasero bpasero added this to the Jan 2016 milestone Dec 23, 2015
@bpasero bpasero self-assigned this Dec 23, 2015
@DerTolleEmil
Copy link
Author

One more update, although that's probably not too surprising: The file was saved on an NTFS partition.

@DerTolleEmil
Copy link
Author

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. code.bat "test ")

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.

@bpasero
Copy link
Member

bpasero commented Dec 24, 2015

Good reference: https://en.wikipedia.org/wiki/Filename

@bpasero bpasero changed the title Windows: Missing sanity check on filenames (trailing dots) Sanity check file names before writing to disk Dec 24, 2015
@bpasero bpasero assigned dbaeumer and unassigned bpasero Jan 25, 2016
@dbaeumer dbaeumer added the verified Verification succeeded label Jan 29, 2016
@Tyriar Tyriar reopened this Feb 29, 2016
@Tyriar Tyriar assigned Tyriar and unassigned dbaeumer Feb 29, 2016
@Tyriar Tyriar modified the milestones: March 2016, Jan 2016 Feb 29, 2016
@Tyriar Tyriar closed this as completed in 4b8c6d8 Feb 29, 2016
@Tyriar Tyriar removed the verified Verification succeeded label Feb 29, 2016
@Tyriar
Copy link
Member

Tyriar commented Feb 29, 2016

New fix needs to be re-verified on Windows.

Tyriar added a commit that referenced this issue Mar 3, 2016
@bpasero bpasero assigned bpasero and unassigned Tyriar Mar 3, 2016
@bpasero bpasero added the verified Verification succeeded label Mar 17, 2016
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug file-explorer Explorer widget issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants