Merge pull request #66 from KoyamaSohei/patch-1

Fix panic on serving not-exists dir
pull/67/head
Fenny 2020-02-06 12:21:06 -05:00 committed by GitHub
commit 62bfc83ef1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -9,6 +9,7 @@ package fiber
import (
"log"
"os"
"path/filepath"
"strings"
)
@ -36,6 +37,11 @@ func (r *Fiber) Static(args ...string) {
wildcard = true
}
// Check if root exists
if _, err := os.Lstat(root); err != nil {
log.Fatal("Static: ", err)
}
// Lets get all files from root
files, _, err := getFiles(root)
if err != nil {