aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoramy <[email protected]>2023-07-08 10:28:38 +0000
committeramy <[email protected]>2023-07-08 10:28:38 +0000
commitaaa5b78151271f6488a33ff7c89434a4a3b4fc45 (patch)
treeeda3964b9c982e287f7a70562e64e43717cce90d
parent31da815d8329f047a7a4232ff5f4710e7a9332dc (diff)
fixed path cleaning
fixed path cleaning with leading '..'s (from submitting to leetcode lol)
-rw-r--r--src/jssh.js2
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("/"));
}
}