commit 5d43215b6f73e6a45da02d7868786eb84195163a from: Omar Polo date: Fri Aug 13 13:15:40 2021 UTC redirect on directories without slash commit - 5cbe17635e5b5884548a53bd3c09b401dbd15e51 commit + 5d43215b6f73e6a45da02d7868786eb84195163a blob - 3f17a51e34489942a6dae397473b4c45c8382015 blob + 5e45edf11181eb8401fa8f9616db747e5f189a34 --- fs.c +++ fs.c @@ -223,9 +223,18 @@ send_dir(uint32_t peerid, const char *path) { struct dirent **names; struct evbuffer *ev; + char *s; int (*selector)(const struct dirent *) = select_non_dot; int i, len; + if (!has_suffix(path, "/")) { + if (asprintf(&s, "%s/", path) == -1) + die(); + send_hdr(peerid, 30, s); + free(s); + return; + } + if (!strcmp(path, "/")) selector = select_non_dotdot;