-
Notifications
You must be signed in to change notification settings - Fork 93
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
Why does tmp remove quotes from paths ? #268
Comments
This was introduced in c8823e5 |
The correct fix for #246 was just to use |
Double quotes are reserved characters and must not be used in filenames. As for single quotes they have also been eliminated since on linux there is no way to tell whether the quotes are part of the name or are being used for quoting a string with whitespace in it. E.g. these are valid path names on linux for a directory called
And it becomes even more complicated when spanning directory tree nodes, e.g.
so if you fix the other then you introduce a whole lot of possibilities for the user to break things by passing in weirdly quoted paths. Any ideas? |
You don't need to / must not alter paths in this library. In bash:
In cmd:
A directory named |
To recap
What about whitespace normalization? In the past, whitespace has been used for "hiding" directories on the server once that it was compromised, e.g. ATM tmp normalizes the whitespace so that it will reduce all surrounding whitespace to just one whitespace and prevents use of whitespace only components in a given path. |
@zvin user names, when added through the local users and groups management cannot contain any of these special characters what you are talking about is an abstraction that was added by windows 10 or before, where users can have arbitrary names, yet, these will be slugged into a filesystem compatible name. so if you created your user, like i did in a previous installation of windows 10, using for example the email address, this will then be truncated to just a few characters of that address, say And even if you use Regardless, we, that is I stand by the decision that quotes (and other stuff) must be eliminated from tmp generated names or directories unless you prove me wrong. |
however, i do not know, why the |
@zvin and we did not have any complaints since the changes were in effect. however, i do not know whether anyone uses the new version as we do not get any feedback, except for yours, of course. |
Alright, keep your bugs then.
This is not true, you can create users with ampersands and quotes in the username on Windows 10, these characters will remain in the folder name on the filesystem.
There was at least me, the author of #246 and a thumbs up above.
And thus pointing to files or directories that do not exist. |
Just want to chime in with my "complaint." This is causing issues for us as some Windows users have apostrophes in their profile name, leading to temp file paths with nonexistent directories when using this library. |
My project recently updated tmp from I agree with @zvin. Whatever |
Issue #246 was invalid. The reporter did not use Fun fact: |
…gle quotes from os.tmpdir also sanitize dir option, the template option and the name option" This reverts commit c8823e5. Single quotes must not be removed from paths because they are valid (even if hard to use) on all OSes. Double quotes are only disallowed on Windows, but tmp should not change any arg it gets; instead, it should rely on the underlying fs API to fail with an error that the user needs to fix.
Operating System
NodeJS Version
Tmp Version
0.2.1
Expected Behavior
Don't remove quotes from paths
Experienced Behavior
Quotes are being removed
See https://github.com/raszi/node-tmp/blob/master/lib/tmp.js#L564-L575
For example on Windows the tmpdir is in general in
C:\Users\username\AppData\Local\Temp
. A username may contain a quote and / or a double quote (Bob's Computer
for example)._getTmpName
calls_sanitizeName
onos.tmpdir()
and returns a folder that does not exist.The text was updated successfully, but these errors were encountered: