diff options
author | Omar Polo <op@omarpolo.com> | 2022-07-04 14:31:17 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2022-07-04 14:31:17 +0000 |
commit | 543f4a66fec191b16621ae4f7783782131a3b067 (patch) | |
tree | 77dcbdb0db85c83a754e76bd0a5dde5d45ee1910 | |
parent | 5734723f92a0fd72967e89f9460ff9552ea9aff2 (diff) |
add a trailing / for dirs in the directory index.
-rw-r--r-- | server.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -1098,9 +1098,13 @@ client_write(struct bufferevent *bev, void *d) case REQUEST_DIR: /* TODO: handle big big directories better */ for (c->diroff = 0; c->diroff < c->dirlen; ++c->diroff) { + const char *sufx = ""; + encode_path(nam, sizeof(nam), c->dir[c->diroff]->d_name); - evbuffer_add_printf(out, "=> ./%s\n", nam); + if (c->dir[c->diroff]->d_type == DT_DIR) + sufx = "/"; + evbuffer_add_printf(out, "=> ./%s%s\n", nam, sufx); free(c->dir[c->diroff]); } free(c->dir); |