From a4c12e7ccc11f5f15e0e81db0be2a908eab5b141 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Thu, 9 Mar 2023 01:17:37 +0100 Subject: Translate whitespace to '+' in append_form Otherwise, every function calling get_forms must implement this. --- main.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/main.c b/main.c index 4d950cd..a6c5809 100644 --- a/main.c +++ b/main.c @@ -145,6 +145,14 @@ static struct form *append_form(struct form *forms, const char **const s, goto end; } + /* HTML input forms use '+' for whitespace, rather than %20. */ + { + char *c = f->value; + + while ((c = strchr(c, '+'))) + *c = ' '; + } + *s = end; ret = forms; @@ -818,17 +826,6 @@ static int createdir(const struct http_payload *const p, goto end; } - /* HTML input forms use '+' for whitespace, rather than %20. */ - { - char *c = name, *d = dir; - - while ((c = strchr(c, '+'))) - *c = ' '; - - while ((d = strchr(d, '+'))) - *d = ' '; - } - const char *const root = auth_dir(a); if (!root) -- cgit v1.2.3