mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
os: improve path check with direct index access
PR-URL: https://github.com/nodejs/node/pull/55434 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
This commit is contained in:
@@ -26,7 +26,6 @@ const {
|
||||
Float64Array,
|
||||
NumberParseInt,
|
||||
ObjectDefineProperties,
|
||||
StringPrototypeEndsWith,
|
||||
StringPrototypeSlice,
|
||||
SymbolToPrimitive,
|
||||
} = primordials;
|
||||
@@ -184,9 +183,9 @@ function tmpdir() {
|
||||
process.env.TMP ||
|
||||
(process.env.SystemRoot || process.env.windir) + '\\temp';
|
||||
|
||||
if (path.length > 1 && StringPrototypeEndsWith(path, '\\') &&
|
||||
!StringPrototypeEndsWith(path, ':\\'))
|
||||
if (path.length > 1 && path[path.length - 1] === '\\' && path[path.length - 2] !== ':') {
|
||||
return StringPrototypeSlice(path, 0, -1);
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user