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 | f0a182976b57126033e45caeed836707da4fb774 (patch) | |
tree | 0e60f2ec5b79224b8c1d4650f9af6a3e49dbc626 /src/jssh.js | |
parent | 00718dcac36ebc725c7bf8ad2015e191d56db32f (diff) |
fixed path cleaning
fixed path cleaning with leading '..'s (from submitting to leetcode lol)
Diffstat (limited to 'src/jssh.js')
-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 ee3eb6d..ffdf1e2 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("/")); } } |