-
Notifications
You must be signed in to change notification settings - Fork 103
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
Add option to filter files #172
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
index.js
Outdated
@@ -50,6 +56,10 @@ async function fastifyStatic (fastify, opts) { | |||
} | |||
} | |||
|
|||
if (!allowedPath(pathname, options.root)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this check, it would be possible to skip the function declaration and the function call that returns true
if (!allowedPath(pathname, options.root)) { | |
if (allowedPath && !allowedPath(pathname, options.root)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
index.js
Outdated
@@ -39,6 +43,8 @@ async function fastifyStatic (fastify, opts) { | |||
maxAge: opts.maxAge | |||
} | |||
|
|||
const allowedPath = opts.allowedPath || allowAllPaths |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const allowedPath = opts.allowedPath || allowAllPaths | |
const allowedPath = opts.allowedPath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Checklist
npm run test
andnpm run benchmark
and the Code of conduct
Closes #145