MCPcopy
hub / github.com/vitejs/vite / toFilePath

Function toFilePath

packages/vite/src/node/server/middlewares/static.ts:94–104  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

92 )
93
94 const toFilePath = (url: string) => {
95 let filePath = cleanUrl(url)
96 if (filePath.includes('%')) {
97 try {
98 filePath = decodeURI(filePath)
99 } catch {
100 /* malform uri */
101 }
102 }
103 return normalizePath(filePath)
104 }
105
106 // Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
107 return function viteServePublicMiddleware(req, res, next) {

Callers 1

servePublicMiddlewareFunction · 0.85

Calls 2

cleanUrlFunction · 0.90
normalizePathFunction · 0.90

Tested by

no test coverage detected