diff options
author | amy <[email protected]> | 2023-07-08 10:28:38 +0000 |
---|---|---|
committer | amy <[email protected]> | 2023-07-08 10:28:38 +0000 |
commit | aaa5b78151271f6488a33ff7c89434a4a3b4fc45 (patch) | |
tree | eda3964b9c982e287f7a70562e64e43717cce90d | |
parent | 31da815d8329f047a7a4232ff5f4710e7a9332dc (diff) |
fixed path cleaning
fixed path cleaning with leading '..'s (from submitting to leetcode lol)
-rw-r--r-- | src/jssh.js | 2 |
1 files changed, 1 insertions, 1 deletions
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("/")); } } |