mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 17:35:57 +00:00
fix(nitro): filter alias in /_vfs
listing (#1296)
This commit is contained in:
parent
9da9240ca8
commit
92547d8547
@ -4,10 +4,11 @@ import { NitroContext } from '..'
|
||||
export function handleVfs (ctx: NitroContext): Handle {
|
||||
return (req) => {
|
||||
if (req.url === '/') {
|
||||
return '<!doctype html><html><body><ul>' + Object.keys(ctx.vfs).map((key) => {
|
||||
const url = encodeURIComponent(key)
|
||||
return `<li><a href="/_vfs/${url}">${key.replace(ctx._nuxt.rootDir, '')}</a></li>`
|
||||
}).join('\n') + '</ul></body></html>'
|
||||
const items = Object.keys(ctx.vfs)
|
||||
.filter(i => !i.startsWith('#'))
|
||||
.map(key => `<li><a href="/_vfs/${encodeURIComponent(key)}">${key.replace(ctx._nuxt.rootDir, '')}</a></li>`)
|
||||
.join('\n')
|
||||
return `<!doctype html><html><body><ul>${items}</ul></body></html>`
|
||||
}
|
||||
const param = decodeURIComponent(req.url.slice(1))
|
||||
if (param in ctx.vfs) {
|
||||
|
Loading…
Reference in New Issue
Block a user