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

Reading a file name with null bytes fails, but has no err.code #517

Closed
domenic opened this issue Jan 19, 2015 · 6 comments
Closed

Reading a file name with null bytes fails, but has no err.code #517

domenic opened this issue Jan 19, 2015 · 6 comments

Comments

@domenic
Copy link
Contributor

domenic commented Jan 19, 2015

As reported in jsdom/jsdom#1003, if you do fs.readFile("<div>\0</div>", "utf-8", function (err) { }) then err will only be detectable via err.toString() == 'Error: Path must be a string without null bytes.'. Having a .code would be better.

@silverwind
Copy link
Contributor

Any suggestions on a code ?

@cjihrig
Copy link
Contributor

cjihrig commented Jan 19, 2015

@domenic is this what you had in mind? The code is subject to change.

@piscisaureus
Copy link
Contributor

the code should be ENOENT, for consistency with other situations where the pathname is invalid.

@cjihrig
Copy link
Contributor

cjihrig commented Jan 19, 2015

@piscisaureus updated to ENOENT in #519

cjihrig added a commit that referenced this issue Jan 19, 2015
This commit adds a code field to the error returned by
nullCheck().

Fixes: #517
PR-URL: #519
Reviewed-By: Ben Noordhuis <[email protected]>
@cjihrig
Copy link
Contributor

cjihrig commented Jan 19, 2015

Landed in 03ee4d8

@cjihrig cjihrig closed this as completed Jan 19, 2015
@domenic
Copy link
Contributor Author

domenic commented Jan 19, 2015

Sweet, thanks!

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

4 participants