Socket
Socket
Sign inDemoInstall

@fastify/static

Package Overview
Dependencies
41
Maintainers
19
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.6.1 to 6.7.0

43

index.js

@@ -352,9 +352,4 @@ 'use strict'

routes.add(route)
fastify.head(route, routeOpts, function (req, reply) {
pumpSendToReply(req, reply, '/' + file, rootPath)
})
fastify.get(route, routeOpts, function (req, reply) {
pumpSendToReply(req, reply, '/' + file, rootPath)
})
setUpHeadAndGet(fastify, routeOpts, route, '/' + file, rootPath)

@@ -371,18 +366,6 @@ const key = path.posix.basename(route)

const file = '/' + pathname.replace(prefix, '')
setUpHeadAndGet(fastify, routeOpts, pathname, file, rootPath)
fastify.head(pathname, routeOpts, function (req, reply) {
pumpSendToReply(req, reply, file, rootPath)
})
fastify.get(pathname, routeOpts, function (req, reply) {
pumpSendToReply(req, reply, file, rootPath)
})
if (opts.redirect === true) {
fastify.head(pathname.replace(/\/$/, ''), routeOpts, function (req, reply) {
pumpSendToReply(req, reply, file.replace(/\/$/, ''), rootPath)
})
fastify.get(pathname.replace(/\/$/, ''), routeOpts, function (req, reply) {
pumpSendToReply(req, reply, file.replace(/\/$/, ''), rootPath)
})
setUpHeadAndGet(fastify, routeOpts, pathname.replace(/\/$/, ''), file.replace(/\/$/, ''), rootPath)
}

@@ -392,4 +375,22 @@ }

}
function setUpHeadAndGet (fastify, routeOpts, route, file, rootPath) {
const toSetUp = {
...routeOpts,
method: ['HEAD', 'GET'],
url: route,
handler: serveFileHandler
}
toSetUp.config = toSetUp.config || {}
toSetUp.config.file = file
toSetUp.config.rootPath = rootPath
fastify.route(toSetUp)
}
function serveFileHandler (req, reply) {
const file = req.routeConfig.file
const rootPath = req.routeConfig.rootPath
pumpSendToReply(req, reply, file, rootPath)
}
}
function checkRootPathForErrors (fastify, rootPath) {

@@ -396,0 +397,0 @@ if (rootPath === undefined) {

{
"name": "@fastify/static",
"version": "6.6.1",
"version": "6.7.0",
"description": "Plugin for serving static files as fast as possible.",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc