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

Illegal file system entry name character creates hidden file content on specific platforms inconsistently #26696

Closed
ghost opened this issue Mar 15, 2019 · 2 comments

Comments

@ghost
Copy link

ghost commented Mar 15, 2019

  • Version: 11.x
  • Platform: Windows
  • Subsystem: fs

We noticed that

fs.mkdirSync("a")
fs.writeFileSync("a/b:c", "123")

console.log(fs.readdirSync("a"))
console.log(fs.readFileSync("a/b:c"))
console.log(fs.readFileSync("a/b"))
  • On Linux: Creates b:c in directory a and reads 123 as its content. Then fails on a/b as non-existing file.

  • On Windows: Creates b in directory a and reads 123 as content of b:c, then also reads a/b as existing file with no content. Readdir displays b as the only file in directory a

We suppose this is some weird Windows quirk, but it's not documented and the behavior is not expected. We suggest adding additional check to writeFile to throw an error if file name contains colon, since it's illegal character in Windows file names.

@richardlau
Copy link
Member

Colons on NTFS files systems on Windows denote file streams: https://docs.microsoft.com/en-us/windows/desktop/fileio/file-streams

@ghost
Copy link
Author

ghost commented Mar 15, 2019

Assuming this is working as intended then. Thanks.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant