-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
os: refine tmpdir() trailing slash stripping #1673
Conversation
os.tmpdir() began stripping trailing slashes in b57cc51. This causes problems if the temp directory is simply '/'. It also stripped trailing slashes without first determining which slash type is used by the current operating system. This commit only strips trailing slashes if another character precedes the slash. On Windows, it checks for ':', as not to strip slashes from something like 'C:\'.
@@ -22,6 +22,9 @@ exports.platform = function() { | |||
return process.platform; | |||
}; | |||
|
|||
const trailingSlashRe = isWindows ? /[^:]\\$/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems like something that should live in path.js, it'd be nice if we could confine a lot of this platform path logic to one place and export it to wherever it's needed
lgtm @Fishrock123 @chrisdickinson can one of you propose a release so we can get this in the wild asap? Note that there's a semver-major in the commit log--we either need to remove that tag from that PR or manually remove the indicator from the changelog; probably the former because this one is likely to be repeated with each npm update. |
LGTM |
os.tmpdir() began stripping trailing slashes in b57cc51. This causes problems if the temp directory is simply '/'. It also stripped trailing slashes without first determining which slash type is used by the current operating system. This commit only strips trailing slashes if another character precedes the slash. On Windows, it checks for ':', as not to strip slashes from something like 'C:\'. It also only strips slashes that are appropriate for the user's operating system. Fixes: #1669 PR-URL: #1673 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Christian Tellnes <christian@tellnes.no>
Landed in 7693705 |
PR-URL: nodejs#1679 Notable Changes: * win,node-gyp: the delay-load hook for windows addons has now been correctly enabled by default, it had wrongly defaulted to off in the release version of 2.0.0 (Bert Belder) nodejs#1433 * os: tmpdir()'s trailing slash stripping has been refined to fix an issue when the temp directory is at '/'. Also considers which slash is used by the operating system. (cjihrig) nodejs#1673 * tls: default ciphers have been updated to use gcm and aes128 (Mike MacCana) nodejs#1660 * build: v8 snapshots have been re-enabled by default as suggested by the v8 team, since prior security issues have been resolved. This should give some perf improvements to both startup and vm context creation. (Trevor Norris) nodejs#1663 * src: fixed preload modules not working when other flags were used before --require (Yosuke Furukawa) nodejs#1694 * dgram: fixed send()'s callback not being asynchronous (Yosuke Furukawa) nodejs#1313 * readline: emitKeys now keeps buffering data until it has enough to parse. This fixes an issue with parsing split escapes. (Alex Kocharin) * cluster: works now properly emit 'disconnect' to cluser.worker (Oleg Elifantiev) nodejs#1386 events: uncaught errors now provide some context (Evan Lucas) nodejs#1654
os.tmpdir()
began stripping trailing slashes in b57cc51. This causes problems if the temp directory is simply'/'
. It also stripped trailing slashes without first determining which slash type is used by the current operating system. This commit only strips trailing slashes if another character precedes the slash. On Windows, it checks for':'
, as not to strip slashes from something like'C:\'
.Related to #1669.