src/nnn.c | 7 ++++++- diff --git a/src/nnn.c b/src/nnn.c index fde07ea5c9cfee579461658409d5e9eb29017da3..5b4f3ad942635feebe3c091ea33b34aaccb44b5b 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -5084,7 +5084,12 @@ if (len <= 0) return; g_buf[len] = '\0'; /* Terminate the path read */ - nextpath = g_buf; + if (g_buf[0] == '/') { + nextpath = g_buf; + len = xstrlen(g_buf); + while (--len && (g_buf[len] == '/')) /* Trim all trailing '/' */ + g_buf[len] = '\0'; + } } else if (op == 'l') { rmlistpath(); /* Remove last list mode path, if any */ nextpath = load_input(fd, *path);