Opened 11 years ago

Last modified 10 years ago

#557 new enhancement

autoindex_show_hidden_files (autoindex feature option to show hidden files

Reported by: Shin Sterneck Owned by:
Priority: minor Milestone:
Component: nginx-module Version:
Keywords: autoindex Cc:
uname -a:
nginx -V: nginx version: nginx/1.6.0

Description

Attached a small patch to the autoindex module adding the option to choose whether to show hidden files or not.

The option can be set as follows:

syntax: autoindex_show_hidden_files on | off;
default: autoindex_show_hidden_files off;
context: http, server, location

Attachments (2)

ngx_autoindex_show_hidden_files.patch (2.2 KB ) - added by Shin Sterneck 11 years ago.
patch to add feature to control visibility of hidden files when using the autoindex module
ngx_autoindex_show_dot_files.patch (2.4 KB ) - added by Shin Sterneck 11 years ago.
patch to introduce new option for autoindex to show dot-files

Download all attachments as: .zip

Change History (6)

by Shin Sterneck, 11 years ago

patch to add feature to control visibility of hidden files when using the autoindex module

by Shin Sterneck, 11 years ago

patch to introduce new option for autoindex to show dot-files

comment:1 by Shin Sterneck, 11 years ago

Because of the following disucssion/feedback in the forum, I have changed the option from "autoindex_show_hidden_files" to "autoindex_show_dot_files" to allow for some cross platform support (windows doesn't hide dot-files, so the word hidden does not make much sense here)

http://forum.nginx.org/read.php?2,216751,249931#msg-249931

New patch is attached to this document: "ngx_autoindex_show_dot_files.patch​"

comment:2 by Shin Sterneck, 11 years ago

the new syntax for this option is now:

syntax: autoindex_show_dot_files on | off;
default: autoindex_show_dot_files off;
context: http, server, location

comment:3 by Alex Storn, 10 years ago

Very bad name for a variable, and very long. Breaks the syntax

Version 0, edited 10 years ago by Alex Storn (next)

comment:4 by Leslie Zhai, 10 years ago

Hi Shin,

It is better to filter .. and .

diff --git a/src/http/modules/ngx_http_autoindex_module.c b/src/http/modules/ngx_http_autoindex_module.c
index f694df0..e4f7b72 100644
--- a/src/http/modules/ngx_http_autoindex_module.c
+++ b/src/http/modules/ngx_http_autoindex_module.c
@@ -279,7 +279,8 @@ ngx_http_autoindex_handler(ngx_http_request_t *r)
 
         len = ngx_de_namelen(&dir);
 
-        if (ngx_de_name(&dir)[0] == '.') {
+        if ((ngx_de_name(&dir)[0] == '.' && len == 1) ||
+            (ngx_de_name(&dir)[0] == '.' && ngx_de_name(&dir)[1] == '.')) {
             continue;
         }
Note: See TracTickets for help on using tickets.