Autoindex hiding dot folders

Hello,

I’m using nginx 1.1.5 and when getting a directory listing via autoindex
directories that start with a dot “.” are not shown.

Is there an option to change this behavior or does anyone know where in
the source code I can change this?

Thank you

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,216751,216751#msg-216751

Hello!

On Sat, Oct 15, 2011 at 05:41:39PM -0400, eiji-gravion wrote:

Hello,

I’m using nginx 1.1.5 and when getting a directory listing via autoindex
directories that start with a dot “.” are not shown.

Yes.

Is there an option to change this behavior or does anyone know where in
the source code I can change this?

No, there is no option. In source code it’s in
src/http/modules/ngx_http_autoindex_module.c:

    if (ngx_de_name(&dir)[0] == '.') {
        continue;
    }

Maxim D.

I realize that this is an old topic, but I bumped into this issue as
well
and submitted a patch, which introduces an additional option to control
whether hidden files are shown or not by the autoindex module.

http://trac.nginx.org/nginx/ticket/557

Best Regards,
Shin

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,216751,249918#msg-249918

Very useful patch but the naming is not correct, . and … or not your
typical hidden type, autoindex_show_dot_folders would make more sense.

And “if (ngx_de_name(&dir)[0] == ‘.’) {” will exclude files which start
with
a dot,

if (ngx_de_name(&dir) == ‘.’) or (ngx_de_name(&dir) == ‘…’) {, would be
better IMHO.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,216751,249925#msg-249925

Thanks for your feedback itpp2012!

Very useful patch but the naming is not correct, . and … or not your
typical hidden type, autoindex_show_dot_folders would make more sense.

You are right, the wording “hidden” is not really good here because
“files”
starting with a ‘dot’ would only be hidden primarily on unix/linux type
system and not e.g: in windows. However since in linux terminology
everything is treated like files (e.g: device files, pipes, directories)
I
think ‘autoindex_show_dot_files’ would make more sense than
‘show_dot_folders’.

And “if (ngx_de_name(&dir)[0] == ‘.’) {” will exclude files which start
with a dot,

if (ngx_de_name(&dir) == ‘.’) or (ngx_de_name(&dir) == ‘…’) {, would be
better IMHO.

I wanted to target all “files” this way, including the file referencing
to
the current directory ("./")as well as the parent directory ("…/"). The
autoindex module would (without this patch) anyway add a html reference
to
the parent directory.

Hence I took your advice and changed the text with a little twist by
changing the option text from “autoindex_show_hidden_files” to
“autoindex_show_dot_files” :wink: Hope this makes sense for you and
everyone
else

I will post an update to this patch in the bug tracker.

Thanks,
Shin

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