-
Notifications
You must be signed in to change notification settings - Fork 773
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
Line breaks in filenames cause infinite loops in mkdirs & mkdirsSync #524
Comments
Huh, these weird cases. What's the result of calling |
|
No wonder it crashes. Not sure what's the best way to solve this, but we need to do something. |
What should happen when a newline character exists in the path? error out? |
@manidlou That's the ugly part. AFAIK, on Windows, newlines aren't allowed. However, they may be allowed on some Linux systems, not sure. We could either error out on a newline, or else put logic in place that if we get |
@wrager I'm leaning in that direction as well. If only Windoze would throw a sensible error for invalid characters instead of |
@wrager yes delegating to the OS makes sense. @RyanZim you are right! there is inconsistency in error codes that OSes throw! Not only that, there is a big discussion on what valid file paths should look like! There is this Wikipedia page on Filename on reserved words and characters in different OSes. IMO, dealing with checking for valid file path (that's what I had originally in my mind) is a mess because of noisy OS differences!
@RyanZim I think that's a good and feasible approach! So then when that happens, we should remove the parent directory that was just created, right? Since essentially it is a failed operation?! |
@manidlou Yeah, we probably should. That's gonna be messy, though. I didn't think about that. |
Well, hopefully nodejs/node#21875 solves this for newer Node versions. |
Should be fixed since #894. |
fs-extra
version: 4.0.3It would be nice to have error handling for line breaks in the
mkdirs
andmkdirsSync
methods.Correct names:
Directories with
\n
in paths are not created. It's okay, but here we get an infinite loop (at least inmkdirsSync
), which is unacceptable in my opinion. Inmkdirs
with callback, the callback is not called.The text was updated successfully, but these errors were encountered: