Fix panic on serving not-exists dir

pull/66/head
KoyamaSohei 2020-02-07 01:35:00 +09:00
parent 91ec284a42
commit ce4f573564
1 changed files with 6 additions and 0 deletions

View File

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