Skip to content

Commit aa971d6

Browse files
timneutkensarunoda
authored andcommitted
Disallow directories in /static (vercel#1028)
1 parent 01cc898 commit aa971d6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

server/render.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,12 @@ export async function serveStaticWithGzip (req, res, path) {
182182
export function serveStatic (req, res, path) {
183183
return new Promise((resolve, reject) => {
184184
send(req, path)
185+
.on('directory', () => {
186+
// We don't allow directories to be read.
187+
const err = new Error('No directory access')
188+
err.code = 'ENOENT'
189+
reject(err)
190+
})
185191
.on('error', reject)
186192
.pipe(res)
187193
.on('finish', resolve)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy