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)
Change History (6)
by , 11 years ago
Attachment: | ngx_autoindex_show_hidden_files.patch added |
---|
by , 11 years ago
Attachment: | ngx_autoindex_show_dot_files.patch added |
---|
patch to introduce new option for autoindex to show dot-files
comment:1 by , 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 , 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 , 10 years ago
Very bad name for a variable, and very long. Breaks the syntax
autoindex_flags dot_files | hidden_files | empty;
autoindex_flags dot_files;
autoindex_flags dot_files hidden_files;
or
autoindex dot_files hidden_files;
autoindex on;
??
comment:4 by , 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; }
patch to add feature to control visibility of hidden files when using the autoindex module