fastify-static
fastify-static copied to clipboard
fix: disable root path check when serve is false
Summary
This MR addresses the issue #460 where the checkRootPathForErrors function still requires a valid path to root even when serve: false is set.
Changes
- Disabled
checkRootPathForErrorswhenserve: false. - Added a unit test to confirm that the root path check is bypassed when
serve: false.
Tests
- Added a test in
test/static.jsto verify thatcheckRootPathForErrorsis not called whenserve: false.
This fix allows users to use the sendFile decorator without needing to serve static files, as requested.
Checklist
- [x] run
npm run testandnpm run benchmark - [x] tests and/or benchmarks are included
- [ ] documentation is changed or added
- [x] commit message and code follows the Developer's Certification of Origin and the Code of conduct