From 3c0e6e01471d9e0e4fa172b2b10875c0e8561291 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Thu, 19 May 2022 03:43:34 +0300 Subject: [PATCH] bugfix... still needs cleanup... Signed-off-by: Alex A. Naanou --- pwiki2.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pwiki2.js b/pwiki2.js index c538780..9c3d345 100755 --- a/pwiki2.js +++ b/pwiki2.js @@ -109,12 +109,17 @@ module.path = { undefined : e == '..' || res[res.length-1] == '>>' ? - res.pop() + ((res.length > 1 + || res[0] != '') + && res.pop()) // NOTE: the last '>>' will be retained... : res.push(e) return res }, []) return format == 'string' ? - path.join('/') + // special case: [''] -> '/' + ((path.length == 1 && path[0] == '') ? + ('/'+ path.join('/')) + : path.join('/')) : path }, relative: function(parent, path, format='auto'){ format = format == 'auto' ?