Skip to content
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

fix: allow fallback to [email protected] route config #410

Merged
merged 2 commits into from
Sep 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,9 @@ async function fastifyStatic (fastify, opts) {
}

function serveFileHandler (req, reply) {
const routeConfig = req.routeOptions.config
// TODO: remove the fallback branch when bump major
/* istanbul ignore next */
const routeConfig = req.routeOptions?.config || req.routeConfig
pumpSendToReply(req, reply, routeConfig.file, routeConfig.rootPath)
}
}
Expand Down Expand Up @@ -552,7 +554,7 @@ function getRedirectUrl (url) {
}

module.exports = fp(fastifyStatic, {
fastify: '^4.23.0',
fastify: '4.x',
name: '@fastify/static'
})
module.exports.default = fastifyStatic
Expand Down