fastify-static
fastify-static copied to clipboard
When using serve: false, root should be optional
Prerequisites
- [X] I have written a descriptive issue title
- [X] I have searched existing issues to ensure the feature has not already been requested
🚀 Feature Proposal
I just want to use the sendFile decorator without serving any files automatically, so I set serve: false. However, I still need to provide a valid path to root, otherwise checkRootPathForErrors complains. Now I resort to creating a dummy directory in tmpdir() just to keep this plugin happy, which seems a bit silly.
I think if serve: false is defined, checkRootPathForErrors should not be called at all.
Motivation
No response
Example
No response
Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.
Thank's for the quick response. I'm currently short on time and I don't think I'll be able to submit a PR at the moment.
Hi @mcollina, I’d like to contribute to this open issue #460. Could you confirm if it’s available to work on?
@Dipali127 Feel free to contribute! We don't assign issues in order to avoid cookie licking.
@Fdawgs I’ve pushed the missing index.js changes. The PR is now ready for review.
@Fdawgs I’ve updated the PR to keep the original styling and added the space before the parentheses as per your suggestion. The functional changes for serve: false behavior remain unchanged.
@Fdawgs Fixed the linting issues. All tests and lint checks now pass locally. Please let me know if any further changes are needed.