1
0
mirror of https://github.com/gofiber/fiber.git synced 2025-02-21 20:13:22 +00:00

Merge pull request #780 from AzSiAz/fix-NotFoundFile-path-to-add-"/"-like-for-Index

🐛 Update filesystem.go to fix NotFoundFile
This commit is contained in:
Fenny 2020-09-14 19:04:05 +02:00 committed by GitHub
commit 2e2bb24972
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,6 +62,9 @@ func New(config Config) fiber.Handler {
if !strings.HasPrefix(cfg.Index, "/") {
cfg.Index = "/" + cfg.Index
}
if cfg.NotFoundFile != "" && !strings.HasPrefix(cfg.NotFoundFile, "/") {
cfg.NotFoundFile = "/" + cfg.NotFoundFile
}
if cfg.Root == nil {
log.Fatal("filesystem: Root cannot be nil")
}