1
0
mirror of https://github.com/gofiber/fiber.git synced 2025-02-21 07:33:06 +00:00

🩹 Fix 403 Directory Index is Forbidden (#329)

* Fix Directory Index is Forbidden
This commit is contained in:
Fenny 2020-04-30 14:21:33 +02:00 committed by GitHub
parent 27a7b21716
commit 75604b0254
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -266,8 +266,10 @@ func (app *App) registerStatic(prefix, root string, config ...Static) {
}
// Serve file
fileHandler(c.Fasthttp)
// End response when file is found
if c.Fasthttp.Response.StatusCode() != 404 {
// Finish request if found and not forbidden
status := c.Fasthttp.Response.StatusCode()
if status != 404 && status != 403 {
return
}
// Reset response