Do not add a trailing / if there is nothing to follow it, Johannes

Altmanninger in GitHub issue 4472.
This commit is contained in:
nicm
2025-04-24 08:55:40 +00:00
parent 68f2ac9296
commit f53fac1b56

View File

@ -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;
}