From 14e08a2067d63f370bcdf82565262f83d0dec986 Mon Sep 17 00:00:00 2001 From: Lauri Kasanen Date: Thu, 22 Apr 2021 11:33:05 +0300 Subject: [PATCH] Add trailing slash in dir listing --- common/network/websocket.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/common/network/websocket.c b/common/network/websocket.c index f0d7f0b..72a101c 100644 --- a/common/network/websocket.c +++ b/common/network/websocket.c @@ -779,7 +779,13 @@ static void dirlisting(ws_ctx_t *ws_ctx, const char fullpath[], const char path[ if (!strcmp(names[i]->d_name, ".") || !strcmp(names[i]->d_name, "..")) continue; - sprintf(buf, "
  • %s
  • ", names[i]->d_name, names[i]->d_name); + if (names[i]->d_type == DT_DIR) + sprintf(buf, "
  • %s/
  • ", names[i]->d_name, + names[i]->d_name); + else + sprintf(buf, "
  • %s
  • ", names[i]->d_name, + names[i]->d_name); + ws_send(ws_ctx, buf, strlen(buf)); }