From 018bf17e2cb9b2af9c2802e2cbab2cd3313c0a86 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 30 Jul 2022 12:06:21 -0700 Subject: path-components-safe: handle consecutive slashes. * stdlib/path-test (path-components-safe): Remove empty components from split path. --- stdlib/path-test.tl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/stdlib/path-test.tl b/stdlib/path-test.tl index c750841e..c0b4ea3e 100644 --- a/stdlib/path-test.tl +++ b/stdlib/path-test.tl @@ -204,8 +204,7 @@ (if-native-windows t (let* ((abs-p (abs-path-p path)) - (comps (sspl path-sep-chars path)) - (comps (if abs-p (cdr comps) comps)) + (comps (remqual "" (sspl path-sep-chars path))) (start (if abs-p "/" "."))) (if (and (nullify path) @@ -228,8 +227,7 @@ (eql st.uid (geteuid))) (let* ((target (readlink nxpath)) (abs-p (abs-path-p target)) - (tcomps (sspl path-sep-chars target)) - (tcomps (if abs-p (cdr tcomps) tcomps))) + (tcomps (remqual "" (sspl path-sep-chars target)))) (when abs-p (set start "/" ok (and (safe-abs-path comps) -- cgit v1.2.3