aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-03-07 12:40:30 +0100
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-03-07 12:40:30 +0100
commit0ca8ea19bcd965233ac4195c285141349fc08855 (patch)
tree3aaee7dac4ffc75d6c63414c83eabeecce95cadc
parent42c23ec1a5a90a97858e469cbc6e88e86a0c43fa (diff)
downloadslcl-0ca8ea19bcd965233ac4195c285141349fc08855.tar.gz
main.c: Replace + with whitespace for directories
-rw-r--r--main.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/main.c b/main.c
index 7e917fc..7914d25 100644
--- a/main.c
+++ b/main.c
@@ -819,8 +819,7 @@ static int createdir(const struct http_payload *const p,
return page_bad_request(r);
}
- char *name = NULL;
- const char *dir = NULL;
+ char *name = NULL, *dir = NULL;
for (size_t i = 0; i < n; i++)
{
@@ -855,10 +854,13 @@ static int createdir(const struct http_payload *const p,
/* HTML input forms use '+' for whitespace, rather than %20. */
{
- char *c = name;
+ char *c = name, *d = dir;
while ((c = strchr(c, '+')))
*c = ' ';
+
+ while ((d = strchr(d, '+')))
+ *d = ' ';
}
const char *const root = auth_dir(a);