Prerequisites
Fastify version
3.21.1
Plugin version
4.2.3
Node.js version
14.17.6
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
11.6
Description
I needed to disable the wildcard setup in favor of explicit static routes so I could use the catch all route for handling non-static pages.
This broke some unrelated route handling later on and I've tracked it back to this change. I have files that need to be served from the /page-data/app/[...]/page-data.json route. This works fine when wildcard: true. However, when wildcard: false the code uses encodeUri on all the file names meaning the server is now listening for /page-data/app/%5B...%5D/page-data.json and breaks my app.
Steps to Reproduce
Try serving a file with fastify-static and wildcard: false. If the file has characters modified by encodeUri then the file will 404.
Expected Behavior
I'd expect that setting wildcard: false would still allow /page-data/app/[...]/page-data.json to be served at it's correct path.
Prerequisites
Fastify version
3.21.1
Plugin version
4.2.3
Node.js version
14.17.6
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
11.6
Description
I needed to disable the
wildcardsetup in favor of explicit static routes so I could use the catch all route for handling non-static pages.This broke some unrelated route handling later on and I've tracked it back to this change. I have files that need to be served from the
/page-data/app/[...]/page-data.jsonroute. This works fine whenwildcard: true. However, whenwildcard: falsethe code usesencodeUrion all the file names meaning the server is now listening for/page-data/app/%5B...%5D/page-data.jsonand breaks my app.Steps to Reproduce
Try serving a file with
fastify-staticandwildcard: false. If the file has characters modified byencodeUrithen the file will 404.Expected Behavior
I'd expect that setting
wildcard: falsewould still allow/page-data/app/[...]/page-data.jsonto be served at it's correct path.