From aaa5b78151271f6488a33ff7c89434a4a3b4fc45 Mon Sep 17 00:00:00 2001 From: amy Date: Sat, 8 Jul 2023 10:28:38 +0000 Subject: fixed path cleaning fixed path cleaning with leading '..'s (from submitting to leetcode lol) --- src/jssh.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jssh.js b/src/jssh.js index 15b3100..208d48f 100644 --- a/src/jssh.js +++ b/src/jssh.js @@ -70,7 +70,7 @@ class jssh { }); for (let i = 0; i != path.length; i++) { if (path[i] == "..") { - path.splice(i - 1, 2); + path.splice(i>0?i-1:0, i>0?2:1); return this.clean_path("/" + path.join("/")); } } -- cgit v1.2.3