From 5b5c8196c3f8dcfd216fd4fdef42fe100d9b7275 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Fri, 5 Jul 2019 14:34:25 +0200 Subject: [PATCH] path: move branch to the correct location This code branch only makes sense when i === length. Otherwise it'll already be handled. PR-URL: https://github.com/nodejs/node/pull/28556 Fixes: https://github.com/nodejs/node/issues/28549 Reviewed-By: Rich Trott Reviewed-By: Weijia Wang Reviewed-By: Anna Henningsen Reviewed-By: Jiawen Geng Reviewed-By: Yongsheng Zhang --- lib/path.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/path.js b/lib/path.js index f7a8612933ad76..e278c891482070 100644 --- a/lib/path.js +++ b/lib/path.js @@ -518,11 +518,11 @@ const win32 = { lastCommonSep = 3; } } + if (lastCommonSep === -1) + lastCommonSep = 0; } let out = ''; - if (lastCommonSep === -1) - lastCommonSep = 0; // Generate the relative path based on the path difference between `to` and // `from` for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {