fastify-static icon indicating copy to clipboard operation
fastify-static copied to clipboard

`dotfiles` option doesn't work with `wildcard: false`

Open geiszla opened this issue 3 years ago • 0 comments

Prerequisites

  • [X] I have written a descriptive issue title
  • [X] I have searched existing issues to ensure the bug has not already been reported

Fastify version

3.27.3

Plugin version

4.5.0

Node.js version

v16.13.1

Operating system

Windows

Operating system version (i.e. 20.04, 11.3, 10)

11

Description

When specifying the dotfiles: 'allow' option together with wildcard: false, the dot files are not returned. Looking into the implementation, this seems to be because glob doesn't have the dot: true option specified, therefore it will not match dotfiles/directories.

Steps to Reproduce

  1. Add a dotfile to the served static files (e.g., .well-known/assetlinks.json)

  2. Register fastify-static with the following options:

    server.register(fastifyStatic, {
      root: '/build/public',
      wildcard: false,
      dotfiles: 'allow',
    });
    
  3. Run curl -L http://localhost:3000/.well-known/assetlinks.json

Expected Behavior

Expected to return the file inside the .well-known directory.

geiszla avatar May 17 '22 13:05 geiszla