From e665cc900d4d614337b3039784fc3dc8c732e8e0 Mon Sep 17 00:00:00 2001 From: Joris Vink Date: Mon, 9 Jul 2018 06:28:28 +0200 Subject: [PATCH] redirect to /uri/ if need be. --- src/filemap.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/filemap.c b/src/filemap.c index b54a57b..52c79c1 100644 --- a/src/filemap.c +++ b/src/filemap.c @@ -259,6 +259,14 @@ lookup: fd = -1; } } else if (S_ISDIR(st.st_mode) && index == 0) { + if (req->path[strlen(req->path) - 1] != '/') { + (void)snprintf(fpath, + sizeof(fpath), "%s/", req->path); + http_response_header(req, "location", fpath); + http_response(req, HTTP_STATUS_FOUND, NULL, 0); + return; + } + len = snprintf(fpath, sizeof(fpath), "%s/%s%s", map->ondisk, path, kore_filemap_index != NULL ?