From f53fac1b56bde6f4861b97d34a2988c2482f3b4a Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 24 Apr 2025 08:55:40 +0000 Subject: [PATCH] Do not add a trailing / if there is nothing to follow it, Johannes Altmanninger in GitHub issue 4472. --- spawn.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spawn.c b/spawn.c index 7ae3f938..d06d3969 100644 --- a/spawn.c +++ b/spawn.c @@ -231,8 +231,9 @@ spawn_pane(struct spawn_context *sc, char **cause) if (sc->cwd != NULL) { cwd = format_single(item, sc->cwd, c, target->s, NULL, NULL); if (*cwd != '/') { - xasprintf(&new_cwd, "%s/%s", server_client_get_cwd(c, - target->s), cwd); + xasprintf(&new_cwd, "%s%s%s", + server_client_get_cwd(c, target->s), + *cwd != '\0' ? "/" : "", cwd); free(cwd); cwd = new_cwd; }