Patch-Source: https://github.com/aperezdc/ngx-fancyindex/commit/83bef5c8a633ebbf96576eeb596a972a5816e057 -- From 83bef5c8a633ebbf96576eeb596a972a5816e057 Mon Sep 17 00:00:00 2001 From: Ryan Schmidt Date: Fri, 13 May 2022 00:16:09 -0500 Subject: [PATCH] Fix 404 not found when indexing filesystem root Backport of https://github.com/nginx/nginx/commit/4c89c09ad8e574509446efab0347b124372bc53a Fixes #107 diff --git a/ngx_http_fancyindex_module.c b/ngx_http_fancyindex_module.c index e6928dd..dd721d0 100644 --- a/ngx_http_fancyindex_module.c +++ b/ngx_http_fancyindex_module.c @@ -684,7 +684,10 @@ make_content_buf( return NGX_HTTP_INTERNAL_SERVER_ERROR; allocated = path.len; - path.len = last - path.data - 1; + path.len = last - path.data; + if (path.len > 1) { + path.len--; + } path.data[path.len] = '\0'; ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,