Wed, 14 Oct 2020 11:07:51 +0200
adds more characters to escape for shell completion
dav/main.c | file | annotate | diff | comparison | revisions |
--- a/dav/main.c Sat Jul 25 13:15:04 2020 +0200 +++ b/dav/main.c Wed Oct 14 11:07:51 2020 +0200 @@ -3372,12 +3372,13 @@ if(space) { size_t l = strlen(elm->path); for(int i=0;i<l;i++) { - // only if we do not quote, we have to escape spaces - if(elm->path[i] == ' ' && quote == '\0') { - ucx_buffer_puts(out, "\\ "); - } else { - ucx_buffer_putc(out, elm->path[i]); + // only if we do not quote, we have to escape + char nextc = elm->path[i]; + if(quote == '\0' && NULL != strchr( + "!\"#$&'()*,;<>?[\\]^`{|}~ ", nextc)) { + ucx_buffer_putc(out, '\\'); } + ucx_buffer_putc(out, nextc); } } else { ucx_buffer_puts(out, elm->path);