Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect default value for dotfiles in docs for express.static #1431

Open
thomas-haufe opened this issue Jun 28, 2023 · 1 comment
Open

Comments

@thomas-haufe
Copy link

I think the default value mentioned at https://github.com/expressjs/expressjs.com/blob/gh-pages/_includes/api/en/4x/express.static.md#expressstaticroot-options is incorrect. It says in the table that the default value is 'ignore', but in the detailed docs at https://github.com/expressjs/expressjs.com/blob/gh-pages/_includes/api/en/4x/express.static.md#dotfiles which are linked in the table, it says this:

With the default value, it will not ignore files in a directory that begins with a dot.

The actual default value seems to be 'allow'.

(The docs for v5 have the same table with the same default value but I don't know whether the behavior changed for v5.)

@lamdevhs
Copy link

lamdevhs commented Oct 4, 2023

I second that there's an issue but the default value isn't "allow" either, it's just some value that isn't actually any of the three proposed (which is definitely a design flaw, IMHO). The serve-static doc is much clearer on that respect:

https://github.com/expressjs/serve-static/blob/9b5a12a76f4d70530d2d2a8c7742e9158ed3c0a4/README.md?plain=1#L59-L60

The default value is similar to `'ignore'`, with the exception that this
default will not ignore the files within a directory that begins with a dot.

Please fix the doc of express to match! I spent half an hour trying to find a solution to hide my .git folders from my public tree before finding this discrepancy and realizing that, in fact, the solution was to set dotfiles to 'ignore', which is counter-intuitive when express's doc says it is already the default value!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants